Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

nested if in mysql

SELECT CASE col1
	WHEN 'agree' THEN 'Ok'
    ELSE
        CASE 
            WHEN col2 >= 1 THEN 'Ko'
            ELSE 'Maybe'
        END
END AS my_result
FROM table_name;
 
PREVIOUS NEXT
Tagged: #nested #mysql
ADD COMMENT
Topic
Name
3+7 =