Thread: COUNT DISTINCT?

COUNT DISTINCT?

From
Josh Berkus
Date:
Folks,

Anybody know a keen shortcut for the following:

SELECT count(skip_date)
FROM (SELECT DISTINCT skip_date FROM weekend_list    WHERE ... ...) days_to_skip;

That's a double aggregate, and is bound to be dog-slow.

--
-Josh BerkusAglio Database SolutionsSan Francisco



Re: COUNT DISTINCT?

From
Stephan Szabo
Date:
On Tue, 30 Jul 2002, Josh Berkus wrote:

> Folks,
>
> Anybody know a keen shortcut for the following:
>
> SELECT count(skip_date)
> FROM (SELECT DISTINCT skip_date FROM weekend_list
>         WHERE ... ...) days_to_skip;
>
> That's a double aggregate, and is bound to be dog-slow.

Would that be the same as:
select count(distinct skip_date) from weekend_listwhere ...



Re: COUNT DISTINCT?

From
Josh Berkus
Date:
Stephan,

> Would that be the same as:
> select count(distinct skip_date) from weekend_list
>  where ...

Yeah, that would be what I was looking for.

--
-Josh BerkusAglio Database SolutionsSan Francisco