1、需求分析
將數據使用group by 分組,某個字段既有null值,又有''值,想將這兩種數據都分爲一類命名爲other。
2、mysql語句
select count(id) total,
case name when ''
then 'other'
else ifnull(name ,'other')
end name
from case_detail group by name
1、需求分析
將數據使用group by 分組,某個字段既有null值,又有''值,想將這兩種數據都分爲一類命名爲other。
2、mysql語句
select count(id) total,
case name when ''
then 'other'
else ifnull(name ,'other')
end name
from case_detail group by name