Group by date_part - Mailing list pgsql-sql

From Graham Vickrage
Subject Group by date_part
Date
Msg-id NDBBJABDILOPAOOMFJHOIEEJCMAA.graham@digitalplanit.com
Whole thread Raw
Responses Re: Group by date_part  (Roberto Mello <rmello@cc.usu.edu>)
List 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 by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: Problems with PG_DUMP and restore
Next
From: A_Schnabel@t-online.de (Andre Schnabel)
Date:
Subject: Re: Problems with PG_DUMP and restore