0
select IFNULL(valor_unit,0) from tb_itens where id = 3
In the scenario where the id = 3 does not exist in my table the SELECT does not return '0' just keeps returning NULL,
I can’t find the problem.
I’ve tested with COALESCE, but keeps returning null.
Uhm, I got it. I thought that by not finding some value, juxtaposition by the Where condition imposed, it would return me null (in case '0'). Thank you.
– Maurício Sanches
Yes, it makes sense your reasoning, but as the
whereis processed before theselect, that only returns what was filtered, will never get to process a null :)– Ricardo Pontual