select *,(CASE WHEN age>=60 THEN '老年' WHEN age<60 AND age>=30 THEN '中年' WHEN age<30 AND age>=18 THEN '青年' ELSE '未成年' END) as age_text from user
更多写法参考:http://www.cnblogs.com/martinzhang/p/3220595.html
select *,(CASE WHEN age>=60 THEN '老年' WHEN age<60 AND age>=30 THEN '中年' WHEN age<30 AND age>=18 THEN '青年' ELSE '未成年' END) as age_text from user
更多写法参考:http://www.cnblogs.com/martinzhang/p/3220595.html