Skip to content
Advertisement

Mysql if Null or Empty String then Show N/A

Hello I’m new to mysqsl and I’m trying to display N/A if the return data is empty or NULL but my query is unrecognized statement type. What do you think is wrong with my query? wrong placement of code?

END

Advertisement

Answer

Use IF with ISNULL here:

If you really wanted to use a CASE expression, then it would need to appear inside the select clause, something like this:

But COALESCE is much more terse and appropriate here.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement