View Full Version : Query - one works, one doesnt - help please


Chaz
07-09-2009, 05:10 AM
OK, im counting stock in my tables by use of a query.

This one works perfectly:

SELECT Count(t_services.Services_ODU_A) AS CountOfServices_ODU_A
FROM t_services
GROUP BY t_services.Services_TNE_Number
HAVING (((Count(t_services.Services_ODU_A))=1));

this one gives me no result, despite that I know there is a count of ~ 60.

SELECT Count(t_services.Services_ODU_B) AS CountOfServices_ODU_B
FROM t_services
GROUP BY t_services.Services_TNE_Number
HAVING (((Count(t_services.Services_ODU_B))=2));

The one is a copy paste of the other - only difference is one is Side A and one is Side B and on Side A I count 'LOW' ODU and on Side B I count 'High' ODU, which is differentiated by the criteria 1 and 2, respectively. I have more that dont work, all the same issue - what have I missed?

Chaz
07-09-2009, 05:12 AM
Nevermind - just realised after re reading the SQL code.

It was not using the criteria of 2 on the device description, I was trying to use the criteria on the count. Ironically the first one worked as it counts each as 1 .....

My bad.