RosettaCodeData/Task/Conditional-structures/SQL/conditional-structures-1.sql

10 lines
220 B
MySQL
Raw Normal View History

2013-04-10 22:43:41 -07:00
case when a then b else c end
declare @n int
set @n=124
print case when @n=123 then 'equal' else 'not equal' end
--If/ElseIf expression
set @n=5
print case when @n=3 then 'Three' when @n=4 then 'Four' else 'Other' end