Why mysql query doesn't return 0 when is null -
i'm trying return values 0 when field null. example if there 1 id_articulo importe null, query return 0.
table
create table `pujas` ( `id_puja` int(11) not null auto_increment, `id_articulo` int(11) default null, `id_usuario` int(11) default null, `tiempo` timestamp not null default current_timestamp, `importe` int(11) default null, primary key (`id_puja`) ) engine=innodb auto_increment=3 defau lt charset=latin1;
query
select ifnull(max(importe),0) pujas group id_articulo
you forgot 2nd argument of ifnull()
function
select ifnull(max(importe), 0) pujas group id_articulo
Comments
Post a Comment