Discussion:
sql count(distinct(empid)) help
(too old to reply)
unknown
2009-10-29 17:13:07 UTC
Permalink
this works fine, returns count quickly:

select count(distinct(empid)) as eecount
from pr_detail_view

whereas this does not, at least quickly, I've never waited
until it finished, if it ever would...

select eefile.eecount
from (select count(distinct(empid)) as eecount
from pr_detail_view) eefile

What am I doing wrong? Why the performance hit? Thanks....
Terry Dykstra [TeamSybase]
2009-10-29 19:55:18 UTC
Permalink
That's a question for your DBMS vendor.
--
Terry Dykstra (TeamSybase)
http://powerbuilder.codeXchange.sybase.com/
http://casexpress.sybase.com
product enhancement requests:
http://my.isug.com/cgi-bin/1/c/submit_enhancement
Post by unknown
select count(distinct(empid)) as eecount
from pr_detail_view
whereas this does not, at least quickly, I've never waited
until it finished, if it ever would...
select eefile.eecount
from (select count(distinct(empid)) as eecount
from pr_detail_view) eefile
What am I doing wrong? Why the performance hit? Thanks....
Loading...