Group By and Having

Lynn_AccessUser

Registered User.
Local time
Today, 12:42
Joined
Feb 4, 2003
Messages
125
I have the following code:

SELECT ClassID, COUNT(*) AS Total
FROM dbo.tbl_Claimant
GROUP BY ClassID

The problem is I want to filter out PersonID <> 20 but when I do that I have to put PersonID in the group by and then it groups it by PersonID instead of just ClassID. So instead of getting 10 ClassID with a count I get 100 records with a count.

Any suggestions?
 
Got it . . . I was putting the where clause after the group by which is why it never worked and I thought I had to do something else. Thanks
 

Users who are viewing this thread

Back
Top Bottom