Title: RE: SQL question

The non-working code in your example should be

select count(*)
from (select distinct ename,job from emp)
/

It appears that cound takes only one parameter ... not two.
Raj
______________________________________________________
Rajendra Jamadagni              MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.
QOTD: Any clod can have facts, but having an opinion is an art!


-----Original Message-----
From: Charu Joshi [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 1:19 PM
To: Multiple recipients of list ORACLE-L
Subject: SQL question


Hello Listers,

How to find out the COUNT of DISTINCT values of multiple columns?

For eg.

SQL> SELECT DISTINCT ename FROM emp;
-- This works.

SQL> SELECT COUNT(DISTINCT ename) FROM emp;
-- So does this.

SQL> SELECT DISTINCT ename, job FROM emp;
-- And this too.

SQL> SELECT COUNT(DISTINCT ename, job) FROM emp;
-- So why does this fail?

I can do a COUNT(DISTINCT ename || job), but that doesn't seem to be elegant
way of doing it.

I have a feeling I might be missing some fairly basic syntax, but feeling
dumb is better than suspense.

Thanks & regards,
Charu.

*********************************************************
Disclaimer

This message (including any attachments) contains
confidential information intended for a specific
individual and purpose, and is protected by law.
If you are not the intended recipient, you should
delete this message and are hereby notified that
any disclosure, copying, or distribution of this
message, or the taking of any action based on it,
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com



--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Charu Joshi
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

*********************************************************************This e-mail 
message is confidential, intended only for the named recipient(s) above and may 
contain information that is privileged, attorney work product or exempt from 
disclosure under applicable law. If you have received this message in error, or are 
not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 
and delete this e-mail message from your computer, Thank 
you.*********************************************************************1


Reply via email to