Select Query

  • Thread starter Thread starter William Ryan
  • Start date Start date
W

William Ryan

Instead of distinct you can use a Having Clause with
Group BY


Select Col1, Col2, Col3 From Sometable
Group by Col1 Having COunt(Col1) = 1

I think this should work for you.

Good Luck,

Bill
(e-mail address removed)
 
you cannot use col2 and col3 in the select list of a query which uses GROUP
BY unless until they are also being used in
GROUP BY clause or used with AGGREGATE function...you will get compilation
error...
 
If so, it's only b/c of the limitation of your specific
DB. The SQL spec supports it, and I know SQL Server 7
and 2000, as well as Oracle 8i, 9 support it.

In the SQL Complete reference as well as many examples
like this...
http://www.mis.boun.edu.tr/akbulut/web/course/LinkedDocs%
5C335w2.htm it's fully supported.

Then again, I can't speak to anything but SQL Server and
Oracle.

Cheers,

Bill
 
Back
Top