Skip to content
Advertisement

MYSQL case when error when tried to get value based on condition

Why I am getting error with this query ? Is there something I’m missing ?

So I wanted to get online_date if the “via” field is O, then if the “via” field is M I wanted to get the manual_date

the error message :

Advertisement

Answer

There are some syntax error in query. An comma(,) is missing after a.seqreq. In second case statement it will be case upper(a.via) when 'O' then a.online_date instead of case when upper(a.via) when 'O' then a.online_date.

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