Group by date_part

Поиск
Список
Период
Сортировка
От Graham Vickrage
Тема Group by date_part
Дата
Msg-id NDBBJABDILOPAOOMFJHOIEEJCMAA.graham@digitalplanit.com
обсуждение исходный текст
Ответы Re: Group by date_part  (Roberto Mello <rmello@cc.usu.edu>)
Список pgsql-sql
Hi,

I need to select the amount of orders per day from an order table.

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);



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

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: Problems with PG_DUMP and restore
Следующее
От: A_Schnabel@t-online.de (Andre Schnabel)
Дата:
Сообщение: Re: Problems with PG_DUMP and restore