Re: change a empty value for 0

2006-07-26 Thread obed
On 7/26/06, João Cândido de Souza Neto <[EMAIL PROTECTED]> wrote: Hi. Let me explain something about coalesce. coalesce(field,0) return 0 if the field value equals null or the field value if it´s not null. :-) ooo !!! ok... it's the same to do: case when field is null then 0 else field end

Re: change a empty value for 0

2006-07-26 Thread Jo�o C�ndido de Souza Neto
Hi. Let me explain something about coalesce. coalesce(field,0) return 0 if the field value equals null or the field value if it´s not null. "obed" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > Hi. thanks ! but nop... > > SELECT id_ingenio,cantidad FROM detalle_transaccion

RE: change a empty value for 0

2006-07-25 Thread Quentin Bennett
obed [mailto:[EMAIL PROTECTED] Sent: Wednesday, 26 July 2006 11:12 a.m. To: João Cândido de Souza Neto Cc: mysql@lists.mysql.com Subject: Re: change a empty value for 0 Hi. thanks ! but nop... SELECT id_ingenio,cantidad FROM detalle_transaccion WHERE cantidad IS NULL; Empty set (0.00 sec) and

Re: change a empty value for 0

2006-07-25 Thread obed
Hi. thanks ! but nop... SELECT id_ingenio,cantidad FROM detalle_transaccion WHERE cantidad IS NULL; Empty set (0.00 sec) and with coalesce nop :-( it's the same problem mysql> select id_ingenio, (select case when sum( coalesce(cantidad,NULL) ) is null then 0 else sum(cantidad) end f

Re: change a empty value for 0

2006-07-25 Thread Jo�o C�ndido de Souza Neto
Try this: select id_ingenio, (select sum(coalesce(cantidad,0)) from detalle_transaccion where id_ingenio=ingenio.id_ingenio group by id_ingenio) as cantidad from ingenio LIMIT 5; "obed" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > Hi all ! > > i have two tables ingenio a

Re: change a empty value for 0

2006-07-25 Thread Chris White
> ++--+ > > | id_ingenio | cantidad | > > ++--+ > > | 1 | NULL | > | 2 | NULL | > | 3 | NULL | > | 4 | 2622.77 | > | 5 | NULL | > > ++--+ > 5 rows in set (0.01 sec) You can use