COUNT DISTINCT?

Поиск
Список
Период
Сортировка
Искать

COUNT DISTINCT?

От:
Josh Berkus <josh@agliodbs.com>
Дата:
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?

От:
Stephan Szabo <sszabo@megazone23.bigpanda.com>
Дата:

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?

От:
Josh Berkus <josh@agliodbs.com>
Дата:
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


FAQ