1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
case `gender` when 'male' then 'boy' when 'femal' then 'girl' end case when `age` > 20 then 'adult' when `age` < 20 then 'youth' end case when `age` is null then 'unknown' else cast(`age` as CHAR(2)) end |
Example
1 2 3 4 5 6 7 8 9 10 11 12 |
SELECT a.id, a.pic, a.name, ( case when b.id is null then '0' else '1' end ) as following FROM `users` a left join follows b on b.target_user_id = a.id and b.user_id = 21 where a.id <> '21' order by following desc, a.created_on desc limit 0, 20 |
Every weekend i used to visit this website, for the reason that i
want enjoyment, since this this site conations really fastidious funny information too.