Count Query

G

Guest

Hi,
I'm basing a query on a table,I need ,in one of the fileds of the query to
count the filed Q2 if it's >=7 ,grouped by Caller ID and Language..
Here's the SQL i'm using that produces an error:

SELECT Csat.Language, Csat.CallerId, Count(Csat.Q2Ans) AS CountOfQ2Ans
FROM Csat
GROUP BY Csat.Language, Csat.CallerId
HAVING (((Count(Csat.Q2Ans))>7));
 
G

Guest

count the filed Q2 if it's >=7 ,grouped by Caller ID and Language..

SELECT Csat.Language, Csat.CallerId, Count(Csat.Q2Ans) AS CountOfQ2Ans
FROM Csat
GROUP BY Csat.Language, Csat.CallerId
HAVING (((Count(Csat.Q2Ans))>=7));

You did not say what the error was but you left out the equal sign.
 
G

Guest

I don't get an error message,but the numbers counted are not corect if
compared to the table from which it got the data,I don't know why..
I want to count How many times a certain Caller ID got more than 7...
Thanx
 
P

Pieter Wijnen

Can the Q2Ans field be Null, and you want them included?

Then Use

SELECT Csat.Language, Csat.CallerId, Count(*) AS CountAll
FROM Csat
GROUP BY Csat.Language, Csat.CallerId
HAVING Count(*)>=7;

HTH

Pieter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top