Retorna explicitamente o texto “NULL” na consulta do MySQL quando o resultado é NULL

0

Como eu escreveria uma consulta SQL em um ambiente MySQL onde eu explicitamente substituo todos os valores NULL retornando minha consulta com a palavra NULL?

    
por THE DOCTOR 18.07.2017 / 22:53

1 resposta

1

SELECT COALESCE( yourNullValue , 'NULL') FROM whatever

COALESCE(value,...)

Returns the first non-NULL value in the list, or NULL if there are no non-NULL values.

The return type of COALESCE() is the aggregated type of the argument types.

Source: https://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html#function_coalesce

    
por 18.07.2017 / 23:02