Trying to figure out how to build a custom asset report, but running into issues getting things to group properly.
Would like to have a header for each department, and a sub header for each user in the department. Then list out the assets with name, type, model, barcode number and filter for only In Use devices.
I've been able to get this far:
SELECT MAX(deptDef.DEPTNAME) AS "Department", MAX(deptDef.DEPTNAME) AS "Department", MAX(aaaUser.FIRST_NAME) AS "User", MAX(resource.RESOURCENAME) AS "Asset Name", MAX(productType.COMPONENTTYPENAME) AS "Product Type", MAX(product.COMPONENTNAME) AS "Product", MAX(state.DISPLAYSTATE) AS "Asset State" FROM Resources resource LEFT JOIN ComponentDefinition product ON resource.COMPONENTID=product.COMPONENTID LEFT JOIN ComponentType productType ON product.COMPONENTTYPEID=productType.COMPONENTTYPEID LEFT JOIN ResourceState state ON resource.RESOURCESTATEID=state.RESOURCESTATEID LEFT JOIN ResourceOwner rOwner ON resource.RESOURCEID=rOwner.RESOURCEID LEFT JOIN ResourceAssociation rToAsset ON rOwner.RESOURCEOWNERID=rToAsset.RESOURCEOWNERID LEFT JOIN SDUser sdUser ON rOwner.USERID=sdUser.USERID LEFT JOIN AaaUser aaaUser ON sdUser.USERID=aaaUser.USER_ID LEFT JOIN DepartmentDefinition deptDef ON rOwner.DEPTID=deptDef.DEPTID GROUP BY resource.RESOURCEID, aaaUser.FIRST_NAME ORDER BY 1,3