From: | "D'Arcy" "J(dot)M(dot)" Cain <darcy(at)druid(dot)net> |
---|---|
To: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | SUM() and GROUP BY |
Date: | 1999-01-12 15:38:51 |
Message-ID: | m1005u7-0000bpC@druid.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
[Sorry if this sent twice. I never saw my copy the first time.]
Does this seem right?
druid=> SELECT COUNT(*) FROM acctrans;
count
-----
0
(1 row)
druid=> SELECT client_id, SUM(tramount) FROM acctrans GROUP BY client_id;
client_id|sum
---------+---
|
(1 row)
If there are no rows in the table then shouldn't the result be no rows
when GROUP BY is used? Further, What about this?
druid=> SELECT SUM(tramount) FROM acctrans;
sum
---
(1 row)
Shouldn't that be 0.00?
What will the NUMERIC or DECIMAL types do in these situations? It
looks like INTEGER has the same behaviour as MONEY (which tramount is.)
--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 424 2871 (DoD#0082) (eNTP) | what's for dinner.
From | Date | Subject | |
---|---|---|---|
Next Message | Jose' Soares | 1999-01-12 16:35:25 | Re: [HACKERS] CONSTRAINTS... |
Previous Message | Brook Milligan | 1999-01-12 15:13:43 | lock deadlocks |