I know mysql has such function, but I can't find it.
Let's say I have a column of type enum and it stores one of 3 possible values:
'A', 'D', or 'U'
What I want to do is the result of select to return either A or D or NULL instead of U
basically this is an accecc control value -A for allow, D for deny and U for undefined. But I want the undefined to be returned as null
Let's call my column 'access_control'
so how should I write a select access_control from USER_GROUP?
I hope someone knows exactly how to do this.
SELECT CASE access_control WHEN 'A' THEN 'Allow' WHEN 'D' THEN 'Deny' ELSE NULL END FROM user_group
OK, CASE!. Thank you.
I was going to use REGEX.