Hi all ! i have two tables ingenio and detalle_tanque, detalle_tanque has a foreign key to ingenio, i want to show all the ingenio values and a sum of the cantidad field in the detalle_tanque table for each value in ingenio, but one of the ingenio's values it doesn't exist in detalle_tanque, i get this
mysql> select id_ingenio, (select case when sum(cantidad) is null then 0 else sum(cantidad) end from detalle_transaccion where id_ingenio=ingenio.id_ingenio group by id_ingenio) as cantidad from ingenio LIMIT 5; +------------+----------+ | id_ingenio | cantidad | +------------+----------+ | 1 | NULL | | 2 | NULL | | 3 | NULL | | 4 | 2622.77 | | 5 | NULL | +------------+----------+ 5 rows in set (0.01 sec) i want to change de value of null to 0, but i don't know why i can't do it with sum(cantidad) is null then 0 else sum(cantidad) end thanks in advanced ... any help it will be good for me ... !!! -- http://www.obed.org.mx ---> blog -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]