I know it suppose to be like:
CASE
WHEN search_condition THEN statement_list
[WHEN search_condition THEN statement_list] ...
[ELSE statement_list]
END CASE
But I do not understand this, (maybe because I keep trying to think of it like an if
statement?)
But for example if I have a field on a table called user_role
, which are names like "Manager", "Part Time", etc. and I want to generate a field (role_order
) and give it a different number depending on the role, for example, user_role = "Manager" then role_order = 5.
How can I do this?
Please not I am more looking for a teach a man to fish answer than a give a man a fish answer.
Thanks!!!