SELECT COUNT(*) FROM ( SELECT DISTINCT col1, col2..... FROM ..........)
--- Charu Joshi <[EMAIL PROTECTED]> wrote: > Thanks all, > > My question was related more to the 'design' of SQL language. To my > mind the > expression COUNT(DISTINCT a,b) looked a natural extension of the > syntax > COUNT(DISTINCT a). Even COUNT(DISTINCT(a,b)) would look good enough > to me. > Probably it's too trivial a thing to bother about. Using the > subquery would > very well give the desired results. > > I have been thinking of reading CJ Date and other experts' articles > on the > design (and limitations) of SQL, but couldn't find any good > resources on the > net. If you know of any links, then can you please let me know? > > Thanks once again, > Charu. > > -----Original Message----- > Sent: Wednesday, January 29, 2003 10:04 PM > To: Multiple recipients of list ORACLE-L > > Charu, > The COUNT() function requires a single expression. "ename, job" is > not a valid expression. "ename||job" is a valid expression since it > will > return a single value. > Another alternative would be > select count(*) > from (select distinct ename, job from emp); > > Dan Fink > > -----Original Message----- > Sent: Wednesday, January 29, 2003 11:19 AM > To: Multiple recipients of list ORACLE-L > > 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). > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.net > -- > Author: Fink, Dan > 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). > > ********************************************************* > 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). > ===== Sundeep Maini Consultant Currently on Assignement at Caterpillar Peoria [EMAIL PROTECTED] __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: sundeep maini 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).