Query to show count of IT assets or count of assets that consumed license (MSSQL & PGSQL)

Query to show count of IT assets or count of assets that consumed license (MSSQL & PGSQL)



Tested in Build PGSQL (14300) or MSSQL (14306)



SELECT count(Resources.RESOURCEID) "Count Of Used Assets" FROM Resources LEFT JOIN ComponentDefinition ON Resources.COMPONENTID=ComponentDefinition.COMPONENTID LEFT JOIN ComponentType ON ComponentDefinition.COMPONENTTYPEID=ComponentType.COMPONENTTYPEID LEFT JOIN ResourceType ON ComponentType.RESOURCETYPEID=ResourceType.RESOURCETYPEID LEFT JOIN ResourceCategory ON ComponentType.RESOURCECATEGORYID=ResourceCategory.RESOURCECATEGORYID LEFT JOIN ResourceState ON Resources.RESOURCESTATEID=ResourceState.RESOURCESTATEID WHERE  (((ResourceCategory.CATEGORY like 'IT') AND (ResourceType.TYPE like 'Asset')) AND (ResourceState.RESOURCESTATEID NOT IN (4,5)))

                  New to ADSelfService Plus?