Re: Group by date_part

Поиск
Список
Период
Сортировка
От Roberto Mello
Тема Re: Group by date_part
Дата
Msg-id 20010710133623.A27302@cc.usu.edu
обсуждение исходный текст
Ответ на Group by date_part  ("Graham Vickrage" <graham@digitalplanit.com>)
Список pgsql-sql
On Tue, Jul 10, 2001 at 08:04:55PM +0100, Graham Vickrage wrote:
> 
> The statement I have only selects the count if there is at least 1 order for
> a particular day, which make sense.
> 
> I however need a count of 0 for days that don't have any. Can anyone help?
> 
> SQL:
> 
> SELECT date_part('day', date), count(*)
> FROM client_order WHERE (date >= '01/05/01' AND date < '01/06/01') AND
> status = 'Processing'
> GROUP BY date_part('day', date);
Didn't look very hard, but can't you just add a: 

CASE WHEN count(*) > 0 THEN count(*) ELSE 0 END AS count
-Roberto
-- 
+----| http://fslc.usu.edu USU Free Software & GNU/Linux Club |------+ Roberto Mello - Computer Science, USU -
http://www.brasileiro.net      http://www.sdl.usu.edu - Space Dynamics Lab, Developer    
 
HELP! My hard drive crashed & I can't boot up!


В списке pgsql-sql по дате отправления:

Предыдущее
От: A_Schnabel@t-online.de (Andre Schnabel)
Дата:
Сообщение: Re: Problems with PG_DUMP and restore
Следующее
От: Kristis Makris
Дата:
Сообщение: ERROR: Procedures cannot take more than 16 arguments