Received: from mail1.crcom.net (mail1.crcom.net [208.220.74.12]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA85018 for ; Sun, 15 Aug 1999 10:03:34 -0400 (EDT) (envelope-from len-morgan@crcom.net) Received: from H233.bstx.com (max02-21.crcom.net [208.234.65.78]) by mail1.crcom.net (8.8.8/8.8.8) with SMTP id JAA01435 for ; Sun, 15 Aug 1999 09:03:32 -0500 (CDT) Message-ID: <000501bee726$b7aa08e0$0908a8c0@H233.bstx.com> From: "Len Morgan" To: Subject: Agregate Problem? Date: Sun, 15 Aug 1999 09:01:36 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 I am having a problem with queries that have an aggregate (sum in this case) when no rows meet my criteria. I still get back a row with null values for all fields. Is this the correct behavior? I am trying to sum up daily sales quanties by items and if I don't have any sales on a particular day, I want to print nothing. I thought I could do this by detecting a 0 row count but since I have the aggregates, I still 1 row. Example: SELECT itemno,sum(qty) FROM sales WHERE sale_date = 'now()::date' I would expect to get back zero rows if there were no sales today but I get back 1. Of course I also get back 1 row if I only sold 1 item. Is this a bug or a "feature?" Thanks Len Morgan