3
In a query has many fields not being filled in, would like to exchange the null
that is being printed so that nothing appears in the print.
3
In a query has many fields not being filled in, would like to exchange the null
that is being printed so that nothing appears in the print.
8
Use the function COALESCE
:
COALESCE(coluna, '')
The result of this function is the first of the two arguments that is not null, so if the first is not, it takes the value of the column, otherwise it takes the string empty. This can be used anywhere in the query.
Example:
SELECT nome, COALESCE(endereco, '') AS endereco FROM tabela
IFNULL of the same correct result?
@Viniciosyals in Mysql yes.
Yes, in Postgresql also works.
Browser other questions tagged sql string postgresql null
You are not signed in. Login or sign up in order to post.
Welcome to Sopt. Post your query so we can help.
– Diego