Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 count function to filter

Author  Topic 

Peet
Starting Member

3 Posts

Posted - 2007-07-24 : 08:46:25
Guys,

I'm using the following code and I just want display all glcodes that have a count less than 2:

select glcode,
sum(abs(sysvalue)) 'Movement',
count(glcode) 'Occurances'
from jet
group by glcode
order by occurances

The following sytax works i know i need to use the where function. Does anyone know the syntax?

Cheers

Michael

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2007-07-24 : 08:50:43
select glcode,
sum(abs(sysvalue)) 'Movement',
count(glcode) 'Occurances'
from jet
group by glcode
HAVING COUNT(glcode) < 2
order by occurances

Jim
Go to Top of Page
   

- Advertisement -