mssql:
select xx.id,评价=case
when name='a' then '优秀'
when name='b' then '良好'
else '一般'
end
from xx
mysql:
select total,case
when total>0 then '浪费'
else '节约' end as '评价'
from month
本文详细介绍了MSSQL和MySQL中使用CASE语句进行复杂条件判断的方法,通过具体实例深入探讨了如何在不同场景下灵活运用SQL查询技巧,提升数据处理效率。
mssql:
select xx.id,评价=case
when name='a' then '优秀'
when name='b' then '良好'
else '一般'
end
from xx
mysql:
select total,case
when total>0 then '浪费'
else '节约' end as '评价'
from month
2680
6132

被折叠的 条评论
为什么被折叠?