if else in SQL server select code example
Example: sql CASE
/*CASE statements are used to create different outputs and is
used by SQL as a way to handle if-then logic.*/
SELECT column_name,
CASE
WHEN condition THEN 'Result_1'
WHEN condition THEN 'Result_2'
ELSE 'Result_3'
END
FROM table_name;