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

Popular posts from this blog

Call PHP Function In JavaScript Using Ajax

List of Post Category Wise in wordpress

PHP Script for sending mail with attachment file