Received: from mx99.openu.ac.il (arbel.openu.ac.il [147.233.32.4]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA88420 for ; Sun, 15 Aug 1999 10:26:39 -0400 (EDT) (envelope-from herouth@oumail.openu.ac.il) Received: from talmon.openu.ac.il (talmon.openu.ac.il [147.233.32.11]) by mx99.openu.ac.il (Postfix) with ESMTP for id 46CD74B672; Sun, 15 Aug 1999 17:26:38 +0300 (IDT) Received: from [147.233.159.109] (mac-herouth.pc.openu.ac.il) by talmon.openu.ac.il (Netscape Messaging Server 3.54) with ESMTP id AAA69D5; Sun, 15 Aug 1999 17:30:13 +0300 X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: <000501bee726$b7aa08e0$0908a8c0@H233.bstx.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Sun, 15 Aug 1999 17:27:57 +0300 To: "Len Morgan" , From: Herouth Maoz Subject: Re: [SQL] Agregate Problem? At 17:01 +0300 on 15/08/1999, Len Morgan wrote: > > 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?" This is a correct behaviour when there is no GROUP BY. PostgreSQL does this in GROUP BY, too, unfortunately. But it's not a big problem - you merely have to check whether the returned row has a NULL value instead of the sum. Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma