SQL query noob here.
I'm looking for the existence of two files. With this code, I receive a line item if a machine is false for either of the files. I receive two line items if the machine is false for both files. I would like to ignore the workstations with a single line item and only report on machines missing both files but do that in a single line.
Select Top 1000000 IsNull(dbo.tblComputerSystemProduct.Name, 'Unknown') As Model, dbo.tblComputers.Username, dbo.tblComputers.Computer, tblADComputers.OU, dbo.tblComputers.Lastseen, tblFileVersions.Found, tblFileVersions.FilePathfull, dbo.tblComputers.Computername From dbo.tblComputers Inner Join dbo.tblComputerSystemProduct On dbo.tblComputers.Computername = dbo.tblComputerSystemProduct.Computername Inner Join dbo.web40ActiveComputers On dbo.tblComputers.Computername = dbo.web40ActiveComputers.Computername Inner Join tblADComputers On dbo.tblComputers.Computername = tblADComputers.Computername Inner Join tblFileVersions On dbo.tblComputers.Computername = tblFileVersions.Computername Where IsNull(dbo.tblComputerSystemProduct.Name, 'Unknown') Like '%optiplex%' And tblFileVersions.Found = 'false' And tblFileVersions.FilePathfull Like '%safeboot.sys' And dbo.tblComputers.LastknownIP Like '%10.%' Or IsNull(dbo.tblComputerSystemProduct.Name, 'Unknown') Like '%optiplex%' And tblFileVersions.Found = 'false' And tblFileVersions.FilePathfull Like '%epepcmonitor.exe' And dbo.tblComputers.LastknownIP Like '%10.%' Order By dbo.tblComputers.Username