Tested in build PGSQL (14300) and MSSQL (14306)
select systeminfo.workstationname "Workstation Name",
SoftwareList.SOFTWARENAME "Software Name",
LONGTODATE(SoftwareInfo.filecreatedtime) "Software Installed Date",
LONGTODATE(audithistory.audittime) "Last Scanned Date" ,
sink.productkey "Scanned License Key"
from audithistory
left join systeminfo on systeminfo.workstationid=audithistory.workstationid
LEFT JOIN SoftwareInfo ON SystemInfo.WORKSTATIONID=SoftwareInfo.WORKSTATIONID
LEFT JOIN SoftwareList ON SoftwareInfo.SOFTWAREID=SoftwareList.SOFTWAREID
LEFT JOIN SWinstallationkeyinfo sink ON SoftwareInfo.SoftwareInfoid=sink.SoftwareInfoid
where audithistory.auditstatus='SUCCESS'
and audithistory.auditid in (Select max(audithistory.auditid) from audithistory group by workstationid) ORDER BY 1