SELECT systeminfo.workstationid,
systeminfo.workstationname "Workstation",
aaauser.first_name "UserName",
softwarelist.softwarename "Software Name",
( wmiswusageinfo.softwareusage ) "Software_Usage",
( softwareinfo.fileversion ) "File Version",
( swinstallationkeyinfo.productid ) "Software_ID",
( swinstallationkeyinfo.productkey ) "Software_Key",
Longtodate(softwareinfo.filecreatedtime) "Installed On",
sdorganization.NAME "Site" FROM softwaregroupmember
INNER JOIN softwareinfo
ON softwaregroupmember.softwareid = softwareinfo.softwareid
INNER JOIN systeminfo
ON softwareinfo.workstationid = systeminfo.workstationid
LEFT JOIN resources
ON systeminfo.workstationid = resources.resourceid
LEFT JOIN resourceowner
ON systeminfo.workstationid = resourceowner.resourceid
LEFT JOIN sduser
ON resourceowner.userid = sduser.userid
LEFT JOIN aaauser
ON sduser.userid = aaauser.user_id
LEFT JOIN softwarelist
ON softwareinfo.softwareid = softwarelist.softwareid
LEFT JOIN resourcelocation
ON softwareinfo.workstationid = resourcelocation.resourceid
LEFT JOIN sdorganization
ON resourcelocation.siteid = sdorganization.org_id
LEFT JOIN wmiswusageinfo
ON softwareinfo.softwareinfoid = wmiswusageinfo.softwareinfoid
LEFT JOIN swinstallationkeyinfo
ON softwareinfo.softwareinfoid =
swinstallationkeyinfo.softwareinfoid
WHERE ( softwareinfo.licenseid IS NULL )