Received: from digitalplanit.wdi.co.uk (dp1.eliteukserve.net [62.189.131.209]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6AJ2Za53265 for ; Tue, 10 Jul 2001 15:02:35 -0400 (EDT) (envelope-from graham@digitalplanit.com) Received: from DP (dp0002.demon.co.uk [193.237.187.164]) by digitalplanit.wdi.co.uk (8.9.3/8.9.3) with SMTP id UAA31739 for ; Tue, 10 Jul 2001 20:01:28 GMT From: "Graham Vickrage" To: Subject: Group by date_part Date: Tue, 10 Jul 2001 20:04:55 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200107/112 X-Sequence-Number: 3897 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);