This is the way the SUM() operator works. If there are not any rows it will return NULL. http://dev.mysql.com/doc/mysql/en/GROUP-BY-Functions.html
-----Original Message----- From: Róth Zoltán To: mysql lista Sent: 7/19/04 7:12 AM Subject: 0 or null? Hi! I've upgraded from 3.23.51 to 4.0.20 . The query: SELECT e.id, sum(c.quantity) FROM Execution e left join Couple c on c.executionRef=e.id GROUP BY e.id; If there's no Couple for an Execution the value of the sum(c.quantity) is 0 in 3.23.51 and NULL in 4.0.20. Was it a bug, or is it a feature?:) I bet on bug, but want to be sure before upgrading our main server. I found the following in the change history of 4.0.13.: SUM() didn't return NULL when there was no rows in result or when all values was NULL But it's too general for me... Thank you in advance! Zola -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]