From: | Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il> |
---|---|
To: | "Len Morgan" <len-morgan(at)crcom(dot)net>, <pgsql-sql(at)postgreSQL(dot)org> |
Subject: | Re: [SQL] Agregate Problem? |
Date: | 1999-08-15 14:27:57 |
Message-ID: | l03130309b3dc7e410a29@[147.233.159.109] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Ross J. Reedstrom | 1999-08-15 15:36:26 | Re: [SQL] Multiple values for a field |
Previous Message | Len Morgan | 1999-08-15 14:01:36 | Agregate Problem? |