I have written a report to show our McAfee AntiVirus software modules and versions.
I am having problems with the SQL coding. I want to show all computers that have any of the 4 softwares listed. My report currently shows only computers that have all 4 installed. Changing the "AND" to "OR" breaks the report and shows a list of any software.
Do I need to do 4 different SELECT FROM statements instead maybe?
use lansweeperdb
select co1.ComputerName,
sfw1.SoftwareName, sfw1.SoftwareVersion,
sfw2.SoftwareName, sfw2.SoftwareVersion,
sfw3.SoftwareName, sfw3.SoftwareVersion,
sfw4.SoftwareName, sfw4.SoftwareVersion
from tblComputers co1
left outer join tblSoftware sfw1 on (co1.ComputerName = sfw1.ComputerName)
left outer join tblSoftware sfw2 on (co1.ComputerName = sfw2.ComputerName)
left outer join tblSoftware sfw3 on (co1.ComputerName = sfw3.ComputerName)
left outer join tblSoftware sfw4 on (co1.ComputerName = sfw4.ComputerName)
where
co1.ComputerName like '%'
and
(
(sfw1.SoftwarePublisher like '%McAfee%' and sfw1.SoftwareName like '%VirusScan%')
or
(sfw2.SoftwarePublisher like '%McAfee%' and sfw2.SoftwareName like '%AntiSpyware%')
or
(sfw3.SoftwarePublisher like '%McAfee%' and sfw3.SoftwareName like '%SiteAdvisor%')
or
(sfw4.SoftwarePublisher like '%McAfee%' and sfw4.SoftwareName = 'McAfee Agent')
)
order by co1.ComputerName
Thanks in advance,
Claud