Dont know why you want to query the DB when there aleady a ready made repor for this
monitors -logs - computer status
click on advanced ( blue link)
click on compliance
check infected only
this will give you all the infected machines
if you still want to query the DB these info are stored in SEM_Agent table
select * from SEM_Agent where ( Infected=1)