Re: SQL count question
Posted in 1997
At 12:25 PM 7/25/97 CDT, mbrickley@infoave.net wrote: }On SE 5.01, SCO Unix 3.2v4.2 }I am trying to use the aggregate count(*) to select rows where }there are more than on occurrance. } }The Informix guide to SQL on pg 7-377 shows this statement: } }select fname,count(*) from customer }group by fname }where count(*) > 1 } }This format gave me a syntax error } } }When I put the where before the group by like this: } }select fname,count(*) from customer }where count(*) > 1 }group by fname } } I get a 595 - Bad use of aggregate in this context } }How do I do it? } }TIA, }Matt Brickley } Try this: select fname, count(*) from customer group by fname having count(*) > 1 I've seen some bad SQL/4GL "examples" in Informix manuals as well.