Skip to content
Advertisement

Case statement in multiple conditions?

I want to check the column mr.name, if mr.name is null then i have to replace mr.name as mr.ticket_no. How? Can use if else or case?

When i use like this

it will throw an error

if mr.name = null means i have to replace mr.name = mr.ticket_no. I want to check the column mr.name, if mr.name is null then i have to replace mr.name as mr.ticket_no

Advertisement

Answer

You can use coalesce() to replace null with anything:

But if you are comfortable with case when then use as below:

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