Home Analytics

SQL Query for primary users

Gabriel_LencesGabriel_Lences Customer Advanced IT Monkey ✭✭✭

Hi guys,

We'd like to provide our users with a "summary page" for their Hardware Assets that shows:

Asset Name | Serial Number | HW Asset Status

Everyone should be able to ONLY view their own assets so we need to set up the condition for the HW asset primary user to be identical to the logged in user.

I'm not that skilled with SQL query writing, can anyone help me out a bit with this [i guess it's probably something trivial :) ]


We tried this one but it didn't work:

SELECT [DisplayName],

[HardwareAssetStatus]

   ,[SerialNumber]

 FROM [ServiceManagement].[cachert].[csnCached_HardwareAsset]

WHERE [HardwareAssetHasPrimaryUser_DisplayName] = @UserID


Without the where function it worked fine but showed everything for everyone and we don't really want that 😊

Thanks in advance!

G.

Best Answer

  • Gabriel_LencesGabriel_Lences Customer Advanced IT Monkey ✭✭✭
    Accepted Answer

    Nevermind, got it working , just needed to add ,[HardwareAssetHasPrimaryUser_BaseManagedEntityId] and put that in the WHERE string, don't know what i was thinking equaling the displayname with userid 🙄

Answers

  • Gabriel_LencesGabriel_Lences Customer Advanced IT Monkey ✭✭✭
    Accepted Answer

    Nevermind, got it working , just needed to add ,[HardwareAssetHasPrimaryUser_BaseManagedEntityId] and put that in the WHERE string, don't know what i was thinking equaling the displayname with userid 🙄

Sign In or Register to comment.