mysql case多个关键字 使用and 或者in()
case
when count(0) = 1 and count(0) = 2 and count(0) =3) then ‘lv1’
when count(0) = 4 and count(0) = 5 and count(0) =6) then ‘lv2’
else ‘lv3’
end as pertime
case
when count(0) in (1, 2 ,3) then ‘lv1’
when count(0) in (4 , 5 , 6 )then ‘lv2’
when count(0) in (7 , 8 , 9 , 19 , 11 )then ‘lv3’
else ‘lv4’
end as pertime
MySQL CASE表达式详解
本文深入探讨了MySQL中CASE表达式的使用方法,包括如何利用AND和IN()进行复杂条件判断,实现数据的精细化分类。通过具体示例,展示了CASE表达式在处理不同数值范围时的灵活性,以及它在数据库查询中的强大功能。
1217

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



