Joshi,
SELECT count(*)
FROM (SELECT count(*)
FROM flight_legs
GROUP BY d_actual_time, event_type);
SELECT count(*)
FROM (SELECT DISTINCT d_actual_time, event_type
FROM flight_legs );
The first one took about 37 seconds in returning a count of 357331. The second statement was about 10 seconds quicker.
Jerry Whittle
ASIFICS DBA
NCI Information Systems Inc.
[EMAIL PROTECTED]
618-622-4145
-----Original Message-----
From: Charu Joshi [SMTP:[EMAIL PROTECTED]]
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.