I am what you would consider an SQL beginner, I've only been dealing with it in depth for about 3 - 4 months. I am trying to create a report that will give a certain list of information about a list of machines. The issue I'm running into is that when I run the query that I have below, I will get 4 lines for each of the seperate items from vComputer. From what I can tell the issue is coming from my Resource Association and Item joins, because the duplicate lines seem to only change in those two columes. The two joins are looking for Asset Status and Machine Type. In the report these have to be in text form and not GUID form, which is why I am joining it to the item table. In the results I am seeing one line that has neither status nor machine type, another line that only has the status, another line that has only the machine type and the last line will display both. I get NULL in those columns otherwise. Does anyone have any ideas what I can do to remedy this issue?
Thanks,
Damon
select Distinct IGD.[Display Name] as [Owner],
vCom.Name,
IID.[System Number] as [Asset Tag],
ASItem.Name as [Assets Status],
IM.Manufacturer,
IM.Model,
CTItem.Name as [Computer Type],
ICCD.[Cost Center Code] as [Cost Center Owner],
IGD.[Department] as [Owner Department]
from vcomputer vCom
Left Outer Join Inv_Ownership_Details [IOD] On IOD._ResourceGuid = vCom.Guid
Left Outer Join Inv_Cost_Center_Ownership [ICCO] On ICCO._ResourceGuid = vCom.Guid
Left Outer Join Inv_Cost_Center_Details [ICCD] ON ICCD._ResourceGuid = ICCO.Owner
Left Outer Join Inv_Global_User_General_Details [IGD] On IGD._ResourceGuid = IOD.Owner
Left Outer Join Inv_Identity [IID] On IID._ResourceGuid = vCom.Guid
Left Outer Join Inv_Manufacturer [IM] On IM._ResourceGuid = vCom.Guid
Left Outer Join ResourceAssociation [ASRA] On ASRA.ParentResourceGuid = vCom.Guid
Left Outer Join Item [ASItem] On ASItem.Guid = ASRA.ChildResourceGuid and ASRA.ResourceAssociationTypeGuid = '3028166F-C0D6-41D8-9CB7-F64852E0FD01'
Left Outer Join ResourceAssociation [CTRA] On CTRA.ParentResourceGuid = vCom.Guid
Left Outer Join Item [CTItem] On CTItem.Guid = CTRA.ChildResourceGuid and CTRA.ResourceAssociationTypeGuid = '74C9AD4A-E384-477E-BD06-132A3368E58D'
Order By vCom.Name asc