mysql判断字段为零,返回空字符串

select paymentno,amount, case when amount>0 and amount40 and amount80 then 'high' else 'incorrect' end lvlfrom `penalties`.#对罚款登记分为三类,第一类low,包括大于0小于等于40的罚款,第二类moderate大于40...
mysql判断字段为零,返回空字符串
select paymentno,amount, case when amount>0 and amount<=40 then 'low' when amount>40 and amount<=80 then 'moderate' when amount>80 then 'high' else 'incorrect' end lvlfrom `penalties`.#对罚款登记分为三类,第一类low,包括大于0小于等于40的罚款,第二类moderate大于40 #到80之间的罚款,第三类high包含所有大于80的罚款。

同理查询是否为0 也可用 case when ,
select *** case when ***=0 then '' else '***' end lvl form ****
2014-03-18
mengvlog 阅读 151 次 更新于 2025-12-15 06:05:00 我来答关注问题0
檬味博客在线解答立即免费咨询

mySQL相关话题

Copyright © 2023 WWW.MENGVLOG.COM - 檬味博客
返回顶部