I have a report that runs daily that emails me a list of all software installed over the past 24 hours (thanks to a user on this site). I am trying to modify that report to show software that has been installed over the last week. The SQL below will give me the data that I want, however it is pulling duplicates. If a package was installed on the 3rd date of the cycle, it shows up 4 times on the report. If is was installed on the 6th day, it shows up once. I would like to remove the duplicates to only show each installation the one time. I am adduming that there should be an IF command at some point after the WHERE but I can't get it to work. If anyone has any ideas or thoughts on how to do this, please let me know. Thanks.
SELECT InvHist_AddRemoveProgram.DisplayName as [Product Name],
InvHist_AddRemoveProgram.DisplayVersion as 'Product Version',
vComputer.Name AS [Computer Name],
vComputer.[IP Address],
vComputer.Domain,
case when InstallFlag = 1 then 'Installed' else 'Uninstalled' end as Activity,
InventoryDate as [Inventory Date],
InstallDate as [Install Date]
FROM InvHist_AddRemoveProgram INNER JOIN vComputer ON InvHist_AddRemoveProgram._ResourceGuid = vComputer.Guid
WHERE (InvHist_AddRemoveProgram.DisplayName NOT LIKE '%Update%') and (InstallDate between getdate()-7 and getdate())