tblSoftware.InstallDate and
tblSoftwareHist.InstallDate are always the same for the same AssetID and softID. In the history table, only the
Lastchanged column will be updated to the date when a change in the list of installed software for an asset was detected.
tblSoftwareHist.Lastchanged refers to the date when the computer was scanned and the change was noticed by Lansweeper.
The following report will list all installed software, their install date and the date of the last change listed in
tblSoftwareHist:
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblSoftwareUni.softwareName,
tblSoftwareUni.SoftwarePublisher,
tblSoftware.softwareVersion As [Current version],
tblSoftware.Installdate As [Software Install date],
Case When tLastChange.Action = '1' Then 'Installed'
When tLastChange.Action = '2' Then 'Removed' End As [Last action],
tLastChange.SWVersionChange,
tLastChange.[Last change] As [Action date]
From tblAssets
Inner Join tblSoftware On tblAssets.AssetID = tblSoftware.AssetID
Inner Join tblSoftwareUni On tblSoftware.softID = tblSoftwareUni.SoftID
Left Join (Select tLastSWChange.[Last change],
tblSoftwareHist.Action,
tblSoftwareHist.softid,
tblSoftwareHist.softwareVersion As SWVersionChange,
tblSoftwareHist.AssetID
From (Select Max(tblSoftwareHist.Lastchanged) As [Last change],
tblSoftwareHist.AssetID,
tblSoftwareHist.softid
From tblSoftwareHist
Group By tblSoftwareHist.AssetID,
tblSoftwareHist.softid) tLastSWChange
Inner Join tblSoftwareHist On tLastSWChange.AssetID =
tblSoftwareHist.AssetID And tLastSWChange.softid = tblSoftwareHist.softid
And tLastSWChange.[Last change] = tblSoftwareHist.Lastchanged) tLastChange
On tblAssets.AssetID = tLastChange.AssetID And tblSoftware.softID =
tLastChange.softid
Order By tblAssets.AssetName,
tblSoftwareUni.softwareName