Answers for "mysql case when multiple conditions"

SQL
26

mysql case when multiple conditions

SELECT CASE col1
	WHEN 'agree' THEN 'Ok'
	WHEN 'disagree' THEN 'Ko'
    ELSE
        CASE 
            WHEN col2 >= 1 THEN 'Ko'
            ELSE 'Maybe'
        END
END AS my_result
FROM table_name;
Posted by: Guest on July-04-2021
0

mysql case when multiple conditions

select (
case when (value1 = 1) then (value2)
when (value2 = 1) then (value1) end) as newColumnname  
from tablename where value1 = 1 or value2 = 1
Posted by: Guest on February-08-2021

Code answers related to "mysql case when multiple conditions"

Code answers related to "SQL"

Browse Popular Code Answers by Language