First of all, am I right in thinking that SMS_MonthlyUsageSummary gets the last usage from the last software scan, and may have been used since then, but won't show it?
If so, I am trying to make a collection with systems that haven't used Microsoft Visio 2010 in the last 30 days, and have also checked in in the last 30 days. This is what I have so far:
SELECT SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,
SMS_R_SYSTEM.Name,
SMS_R_SYSTEM.SMSUniqueIdentifier,
SMS_R_SYSTEM.ResourceDomainORWorkgroup,
SMS_R_SYSTEM.Client
FROM SMS_R_SYSTEM
INNER JOIN SMS_MonthlyUsageSummary on SMS_R_SYSTEM.ResourceID = SMS_MonthlyUsageSummary.ResourceID
INNER JOIN SMS_MeteredFiles ON SMS_MonthlyUsageSummary.FileID = SMS_MeteredFile.MeteredFileID
INNER JOIN SMS_G_SYSTEM_LastSoftwareScan on
SMS_R_SYSTEM.ResourceID=SMS_G_SYSTEM_LastSoftwareScan.ResourceID
WHERE DateDiff(day, SMS_MonthlyUsageSummary.LastUsage, GetDate()) > 30
AND SMS_MeteredFiles.RuleID = 16777317
AND WHERE DateDiff(day, SMS_G_SYSTEM_LastSoftwareScan.LastScanDate, GetDate()) <30
I apologise for butchering the language in advance. As I said, I am a rookie.