On 18.10.2013 12:05, Hilario Fernandes wrote:
O made the same test in SP4 and the results were the same, sum(null) kept returning 0 and no results for the case. My tests in SP5 were done with a clean database with no data imported, so according to your tests i should at least have the correct value for the sum...
These are the queries i've done and what i believe would be the expected results:
create table test (number int, name varchar(50));
insert into test values(1,'jonh'); insert into test values(2,'mike'); insert into test values(3,'mary'); insert into test values(null,'austin'); insert into test values(null,'jonh'); insert into test values(null,'mary');
select name, sum(number) from test group by name;
Result: austin | 0 jonh | 1 mary | 3 mike | 2
Expected: austin | null jonh | 1 mary | 3 mike | 2
Hi Hilario, I've tested your query using default branch (11.16.0) and I can confirm that this bug also exist. So probably it depends on type of value by which you group. Probably if you try my example from http://bugs.monetdb.org/show_bug.cgi?id=3388 on fresh database, results should be as expected. So group by int works, but group by varchar doesn't :-(. I'm not sure if this is another bug than 3388 or it is the same. It's rather another one. Klaudiusz