Hi,
Can someone see the problem with the query below? I suspect it has something to do with the JOINS. We have had issues with getting solid counts and a suggestion was made to use the Inv_HW_Chassis table since each system should have a stamp to indicate if it is a desktop or laptop. I do need to bring data from the other tables so the report looks more complete, but the trigger for the query should be the INV_HW_Chassis table, not vComputer.
So in addition to a problem with the JOINS do I have the SELECT statement backwards?
SELECT vComputer.Name AS 'Computer Name', vComputer.[OS Name], vComputer.[OS Revision], vHWComputerSystem.Manufacturer,
vHWComputerSystem.Model, vHWComputerSystem.[Identifying Number] AS 'Serial Number', vHWProcessor.Model AS 'Processor',
vHWComputerSystem.[Total Physical Memory (Bytes)] / 1048576 AS 'RAM (MB)', I.Name AS 'Location', vComputer.[User] AS 'Primary Owner'
FROM vComputer
LEFT OUTER JOIN ResourceAssociation AS loc ON (loc.ChildResourceGuid = vComputer.Guid OR
loc.ParentResourceGuid = vComputer.Guid) AND loc.ResourceAssociationTypeGuid = '05DE450F-39EA-4AAE-8C5F-77817889C27C'
Inv_HW_Chassis AS ch LEFT OUTER JOIN vComputer ON ch._ResourceGuid = vComputer.Guid
LEFT OUTER JOIN vComputer ON ch._ResourceGuid = vComputer.Guid
LEFT OUTER JOIN vComputer ON ch._ResourceGuid = vComputer.Guid vItem AS I ON loc.ChildResourceGuid = I.Guid
LEFT OUTER JOIN vHWProcessor ON vComputer.Guid = vHWProcessor._ResourceGuid
LEFT OUTER JOIN vHWComputerSystem ON vComputer.Guid = vHWComputerSystem._ResourceGuid
WHERE (ch.[Chassis Package Type] IS NULL) OR (ch.[Chassis Package Type] = 3) OR (ch.[Chassis Package Type] = 4) OR (ch.[Chassis Package Type] = 5) OR
(ch.[Chassis Package Type] = 6) OR (ch.[Chassis Package Type] = 7)
ORDER BY 'Computer Name'
The query below is what I am trying to incorporate into the one above:
SELECT ch._ResourceGuid, vComputer.Name, vComputer.[IP Address], vHWComputerSystem.Model, ch.[Chassis Package Type]
FROM Inv_HW_Chassis AS ch LEFT OUTER JOIN vComputer ON ch._ResourceGuid = vComputer.Guid LEFT OUTER JOIN vHWComputerSystem ON vComputer.Guid = vHWComputerSystem._ResourceGuid
WHERE (ch.[Chassis Package Type] IS NULL) OR (ch.[Chassis Package Type] = 3) OR (ch.[Chassis Package Type] = 4) OR (ch.[Chassis Package Type] = 5) OR (ch.[Chassis Package Type] = 6) OR (ch.[Chassis Package Type] = 7)