Which Computers have Winfile.exe installed? version 2

Oops the old version left duplicate PCs.

This version fixes that.

SELECT DISTINCT
CS.Name0,
— (Case when SF.FileName=’winfile.exe’ then ‘Yes’ else ‘ ‘ end) as ‘WinFile’
‘Yes’ as ‘WinFile’
FROM
dbo.v_GS_SoftwareFile SF,
dbo.v_GS_COMPUTER_SYSTEM CS
Where
SF.ResourceID = CS.ResourceID
and SF.FileName=’winfile.exe’

Union

SELECT DISTINCT
CS.Name0,
–(Case when SF.FileName=’winfile.exe’ then ‘Yes’ else ‘ ‘ end) as ‘WinFile’
‘No’ as ‘WinFile’
FROM
dbo.v_GS_SoftwareFile SF,
dbo.v_GS_COMPUTER_SYSTEM CS
Where
SF.ResourceID = CS.ResourceID
and SF.FileName !=’winfile.exe’
and CS.ResourceID not in (Select distinct CS.ResourceID FROM dbo.v_GS_SoftwareFile SF, dbo.v_GS_COMPUTER_SYSTEM CS Where SF.ResourceID = CS.ResourceID and SF.FileName=’winfile.exe’)
ORDER BY CS.Name0

Leave a Reply

Your email address will not be published. Required fields are marked *