Skip to content
Advertisement

MariaDB Case statement

I have the following SQL-Code in a Mariadb-Database: (1)

I need the following result:

If Matrix=’AW’ => I need the field “FaktorAW”

else => I need the field “FaktorGW”

is it possible to formulate Statement (1) with a “case statement”?

Advertisement

Answer

Of course, this is possible. Basically you can do this:

You have to take care if this is really exactly what you want, e.g. this will not check lower/upper case. See the working example: db<>fiddle

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