Select Query

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)
 
N

Nedu N

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...
 
W

William Ryan

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
 

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