Complete report from 5 querys

Pusher

BEOGRAD Put
Local time
Today, 21:30
Joined
May 25, 2011
Messages
230
Hi all,
I have 5 different devices and a query for every one of them separately, that gives me results I need in separate reports. How do i make a complete report that will sum up every result query for every device?
Thanks
 
Does the information on which the 5 queries are based reside in the same table?
 
Yes, but i don't know how to make it so i have like 5 results for 1 device 5 for another...
Code:
SELECT TOP 5 IZVESTAJ.ID_UREDJAJ, IZVESTAJ.ID_RASKRSNICE, Count(IZVESTAJ.ID_GRESKE) AS CountOfID_GRESKE
FROM IZVESTAJ
WHERE (((IZVESTAJ.DATUM_IZVESTAJA) Between Nz([forms]![FrmPrikazIzvestaja]![txtStart],[forms]![FrmPrikazIzvestaja]![txtAltStart]) And Nz([forms]![FrmPrikazIzvestaja]![txtEnd],[forms]![FrmPrikazIzvestaja]![txtAltEnd])) AND ((IZVESTAJ.NEZAVRSENE_INTERVENCIJE)=Yes))
GROUP BY IZVESTAJ.ID_UREDJAJ, IZVESTAJ.ID_RASKRSNICE
HAVING (((IZVESTAJ.ID_UREDJAJ)=[Forms]![FrmPrikazIzvestaja]![Combo58]) AND ((Count(IZVESTAJ.ID_GRESKE)) Is Not Null))
ORDER BY Count(IZVESTAJ.ID_GRESKE) DESC;
Also i get the results that are 0, that i dont want (not null is not working)
 
If you want the top 5 record per group (device) you will need a subquery approach. Allen Browne discusses that on his site here

I would create a query that does all the filtering first (and returns all records you want) for each device then apply the subquery approach indicated above.
 

Users who are viewing this thread

Back
Top Bottom