I have two tables: one table (okay, it’s a view), vComputer, lists many computers by unique GUID. Another table, Inv_Screensaver_File_Info, lists a computer if it has run a custom inventory and reported how current its screensaver files are.
I need to list the GUIDs of all computers who are not present in Inv_Screensaver_File_Info, and also any computers who are present but whose Inv_Screensaver_File_Info.LastModified value is less than a particular record’s result in that table, which represents the authoritative source.
This is the record I want all rows to compare to:
MYSERVER B5A85423-26C4-40C0-DA28-237FB4CB0B33 2012-02-09 11:38:50.000
The unique GUID exists as vc.Guid and also as sfi._ResourceGuid
What is the SQL method for doing this?
SELECT vc.Name,
vc.Guid,
sfi.LastModified
FROM vComputer vc
LEFT OUTER JOIN Inv_Screensaver_File_Info sfi ON sfi._ResourceGuid=vc.Guid
WHERE sfi.LastModified IS NULL
ORDER BY sfi.LastModified DESC
1 Answer