Skip to content
Advertisement

MySQL: Updating multiple columns using if else

I need help to set a mySQL update query for my little project like below:

In my table, there is a column REFERENCE which contains varchar like

where the character before the symbol ‘_’ determines certain values for other columns like stated above. I am still fairly new to mySQL, so appreciates any help!

Advertisement

Answer

You can use case expressions:

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