Search code examples
mysqlsqlmultiple-columnscoalesce

Get all results from the customer table. Replace null values in the state and fax columns with an empty string. How to solve this query?


I am very confused about this question .The thing is know that I can use COALESCE function for this but how ?Because there are 2 columns here ,State and Fax


Solution

  • You can use if null

    select id,ifnull(state, '') as state ,ifnull(fax, '') as fax from customer