I'm using the following statement
SELECT TOP 5 rootcause, COUNT(IIF(accountability="Team 1",1,0))
FROM MOAQ
WHERE CDT=1
GROUP BY rootcause
MOAQ
is another query that returns about 20 fields from 4 tables, nothing special. This works as expected and I get 5 results.
If I add an ORDER BY
clause on the conditional field though I start to get 8 results. If I sort by the first field there is no problem.
Anyone know what might be going on?
Edit to clarify - I am only testing from within Access 2003 at this point, eventual statement will be parameterized query via ADO from Excel front end.