Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: SQL question

Re: SQL question

From: <Jared.Still_at_radisys.com>
Date: Wed, 29 Jan 2003 13:24:24 -0800
Message-ID: <F001.0053DCC4.20030129132424@fatcity.com>


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

elegant = simple, concise, easy to understand.

Looks elegant to me.

Jared

"Charu Joshi" <joshic_at_mahindrabt.com>
Sent by: root_at_fatcity.com
 01/29/2003 10:19 AM
 Please respond to ORACLE-L  

        To:     Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
        cc: 
        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.


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: 
  INET: Jared.Still_at_radisys.com

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: ListGuru_at_fatcity.com (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).
Received on Wed Jan 29 2003 - 15:24:24 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US