Below is the current query used to report a Device information. I need to add “User’s Cost Center” to the report. The problem is I cannot find how to put this in the query. The query currently lists the cost center if this information is annoted on the DEVICE information itself. But what needs to happen is the query pull the “User’s Cost Center” from the User per line of the report.
By default, the "User's Cost Center" field is not part of the User profile. We attached this field
The problem I noticed is that the “User’s Cost Center” column is not located in the vUser view. In the Console the User’s Cost Center is attached to the User Profile.
select a._ResourceGuid,
a.[Asset Type],
[Status],
p.[Phone Number],
a.[Serial Number],
md.[SIM Card #],
u.[Name],
cc.[Cost Center Code] as [Cost Center],
c.[Comment]
from vAsset a
left join Inv_Mobile_Details md on a._resourceGuid = md._ResourceGuid
left join Inv_Phone_Details p on a._resourceGuid = p._ResourceGuid
left join ResourceAssociation raOwner on raOwner.ParentResourceGuid = a._resourceGuid
and raOwner.ResourceAssociationTypeGuid = 'ed35a8d1-bf60-4771-9dde-092c146c485a'
left join vUser u on u.guid = raOwner.ChildResourceGuid
left join Inv_Comment c on a._resourceGuid = c._ResourceGuid
left join ResourceAssociation raCC on raCC.ParentResourceGuid = a._resourceGuid
and raCC.ResourceAssociationTypeGuid = '9bc22d17-c0cf-45d5-9a8f-d62bbafd955d'
left join vCostCenter cc on cc._resourceguid = raCC.ChildResourceGuid
where [Asset Type] in ('Pager', 'Blackberry', 'Cell Phone', 'Mobile Device', 'Aircard')
and [Status] in ('Active', 'In Stock','Loaner In Stock','Loaner Active')