Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

alternative for count(distinct col)

$
0
0
Hi,
Please check the below query:

select e.first_name,e.job_id,
count(distinct e.manager_id),
count(distinct e.salary),
count(distinct e.commission_pct)
from employees e
where e.department_id between 30 and 90
group by e.job_id,rollup(e.first_name);

I need a replacement of this query which should perform in better way with the same logic .The above query count(distinct) taking much time because there are huge no. of records in the table so mainly need an alternative for this count(distinct).

Thanks in Advance

Viewing all articles
Browse latest Browse all 13329

Trending Articles