DISTINCT CLAUSE [message #2240] |
Mon, 01 July 2002 10:45 |
PANKAJ
Messages: 24 Registered: June 2001
|
Junior Member |
|
|
Hi,
I have a table conating 4519 name records.
If I give a query
'Select distinct name from ets1'
it shows me 4477 records.
If I give a query ' SELECT NAME FROM ETS1 MINUS SELECT DISTINCT NAME FROM ETS1'
It gives me reply 'No rows selected'.
Can anybody let me know what happens in distinct clause and if it is giving unique names, how to get balance names.
Thanks
|
|
|
Re: DISTINCT CLAUSE [message #2241 is a reply to message #2240] |
Mon, 01 July 2002 11:00 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
Yes, the DISTINCT clause will give you a unique set of names. The MINUS query did not return any rows because every non-unique name is also in the list of unique names.
If, by "balance names", you mean names that appear more than once, you can:
select name, count(*)
from ets1
group by name
having count(*) > 1;
|
|
|
|