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
Powered by: 博客园 Copyright © 2024 huhuuu Powered by .NET 9.0 on Kubernetes