Aggregate function - COUNT

juicybeasty

Registered User.
Local time
Today, 17:07
Joined
Feb 17, 2003
Messages
52
I think this is pretty simple but I can't get it right!

I need to design a query using COUNT in which there are two different criteria, ie

Source = "recommendation"
CreatedMonth = "nov" or "dec" or "jan" or "feb"

(I want it to tell me how many records there are with source = "recommendation" AND CreatedMonth = "nov" OR "dec" OR "jan" OR "feb")

It gives me the correct amount for recommendation but doesn't work properly if I try and Group By both of these criteria at the same time.

Hope this is not too confusing.
 
((Source = "recommendation") AND (CreatedMonth = "nov" or "dec" or "jan" or "feb" ))

Try that notice the parens.
 
A slight variation here:

SELECT count(*)
FROM YourTable
WHERE source = "recommendation"
AND CreatedMonth IN ("nov","dec","jan", "feb");

RV
 

Users who are viewing this thread

Back
Top Bottom