Can someone please provide me a join that will join vAsset to Vcomputer. In the results of my query I need to add the Computer Name to the report.
Here is the view that needs to be changed.
SELECT DISTINCT a._ResourceGuid, a.[Asset Type], a.[Serial Number], a.Status, u.Name, vum.Name AS [User's Manager],
(SELECT MAX(DATEPART(mm, Month + ' 01 2011')) AS Expr1
FROM dbo.Inv_AeX_AC_Primary_User AS pu2
WHERE (_ResourceGuid = a._ResourceGuid) AND (DATEPART(mm, Month + ' 01 2011') <= DATEPART(mm, DATEADD(Month, - 1, CURRENT_TIMESTAMP))))
AS most_recent_checkin_month,
(SELECT [User]
FROM dbo.Inv_AeX_AC_Primary_User AS pu4
WHERE (_ResourceGuid = a._ResourceGuid) AND (DATEPART(mm, Month + ' 01 2011') =
(SELECT MAX(DATEPART(mm, Month + ' 01 2011')) AS Expr1
FROM dbo.Inv_AeX_AC_Primary_User AS pu2
WHERE (_ResourceGuid = a._ResourceGuid) AND (DATEPART(mm, Month + ' 01 2011') <= DATEPART(mm, DATEADD(Month, - 1,
CURRENT_TIMESTAMP)))))) AS most_recent_checking_user,
(SELECT TOP (1) u4.[Office Location]
FROM dbo.Inv_AeX_AC_Primary_User AS pu4 LEFT OUTER JOIN
dbo.vUser AS u4 ON pu4.[User] = u4.Name
WHERE (pu4._ResourceGuid = a._ResourceGuid) AND (DATEPART(mm, pu4.Month + ' 01 2011') =
(SELECT MAX(DATEPART(mm, Month + ' 01 2011')) AS Expr1
FROM dbo.Inv_AeX_AC_Primary_User AS pu2
WHERE (_ResourceGuid = a._ResourceGuid) AND (DATEPART(mm, Month + ' 01 2011') <= DATEPART(mm, DATEADD(Month, - 1,
CURRENT_TIMESTAMP)))))) AS most_recent_checkin_user_location, vcc.Name AS [User's Cost Center],
cc.[Cost Center Code] AS [Asset Cost Center], loc.Name AS Location, u.[Office Location] AS UserLocation,
(SELECT COUNT(DISTINCT _ResourceGuid) AS Expr1
FROM dbo.vAsset AS s2
WHERE ([Serial Number] = a.[Serial Number])) AS count_resource_with_this_sn, raCC.CreatedDate
FROM dbo.vAsset AS a LEFT OUTER JOIN
dbo.ResourceAssociation AS raOwner ON raOwner.ParentResourceGuid = a._ResourceGuid AND
raOwner.ResourceAssociationTypeGuid = 'ed35a8d1-bf60-4771-9dde-092c146c485a' LEFT OUTER JOIN
dbo.vUser AS u ON u.Guid = raOwner.ChildResourceGuid LEFT OUTER JOIN
dbo.ResourceAssociation AS uCostCenter ON uCostCenter.ParentResourceGuid = u.Guid AND
uCostCenter.ResourceAssociationTypeGuid = 'e1659909-3ac0-4abe-8eef-ed0b59823123' LEFT OUTER JOIN
dbo.vCostCenter AS vcc ON uCostCenter.ChildResourceGuid = vcc._ResourceGuid LEFT OUTER JOIN
dbo.ResourceAssociation AS uum ON uum.ParentResourceGuid = u.Guid AND
uum.ResourceAssociationTypeGuid = '049c633f-8413-42ae-93ea-f4eb7edafc65' LEFT OUTER JOIN
dbo.vUser AS vum ON uum.ChildResourceGuid = vum.Guid LEFT OUTER JOIN
dbo.Inv_Mobile_Details AS md ON md._ResourceGuid = a._ResourceGuid LEFT OUTER JOIN
dbo.ResourceAssociation AS raCC ON raCC.ParentResourceGuid = a._ResourceGuid AND
raCC.ResourceAssociationTypeGuid = '9bc22d17-c0cf-45d5-9a8f-d62bbafd955d' AND raCC.CreatedDate =
(SELECT MAX(CreatedDate) AS Expr1
FROM dbo.ResourceAssociation AS raCC2
WHERE (ParentResourceGuid = a._ResourceGuid)) LEFT OUTER JOIN
dbo.vCostCenter AS cc ON cc._ResourceGuid = raCC.ChildResourceGuid LEFT OUTER JOIN
dbo.ResourceAssociation AS raLocation ON raLocation.ParentResourceGuid = a._ResourceGuid AND
raLocation.ResourceAssociationTypeGuid = '05DE450F-39EA-4AAE-8C5F-77817889C27C' LEFT OUTER JOIN
dbo.vLocation AS loc ON loc._ResourceGuid = raLocation.ChildResourceGuid
WHERE (a.[Asset Type] = 'Computer' OR
a.[Asset Type] = 'Monitor') AND (a.Status = 'Active' OR
a.Status = 'Active - Lease Past Due' OR
a.Status = 'In Stock - Waiting Decision') AND (u.Name NOT LIKE '%INFRASTRUCTURE%' OR
u.Name IS NULL) AND (a.[Serial Number] IS NOT NULL)