Home » SQL & PL/SQL » SQL & PL/SQL » DISTINCT CLAUSE
DISTINCT CLAUSE [message #2240] Mon, 01 July 2002 10:45 Go to next message
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 Go to previous messageGo to next message
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;
Re: DISTINCT CLAUSE [message #2245 is a reply to message #2241] Mon, 01 July 2002 14:14 Go to previous message
PANKAJ
Messages: 24
Registered: June 2001
Junior Member
Thanks Todd
Previous Topic: Controlling CPU usage when running procedure
Next Topic: PL/SQL Package not returning SQLCODE for not found
Goto Forum:
  


Current Time: Wed Apr 24 14:40:46 CDT 2024