SUM() and GROUP BY

Поиск
Список
Период
Сортировка
От D'Arcy" "J.M." Cain
Тема SUM() and GROUP BY
Дата
Msg-id m0zyftX-0000fKC@druid.net
обсуждение исходный текст
Список pgsql-hackers
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@{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.


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Paul A Vixie
Дата:
Сообщение: 6.4 lateness and CIDR
Следующее
От: The Hermit Hacker
Дата:
Сообщение: Re: [HACKERS] 6.4 lateness and CIDR