case when then in mysql
gender = column name
table = table name
SELECT * ,
CASE gender when 'm' then 'male'
when 'f' then 'Female' else gender
END as ty
FROM Table
SELECT * ,
CASE when id > 5 then 'male'
when id < 5 then 'Female' else gender
END as ty
FROM Table
Comments
Post a Comment
If you Satisfied , Please Leave a comment