state 0, 1,2 // 未使用 更新 删除
根据customerid写一条sql (注意是一条)生成表的结构如下:
customerid state0 state1 state2
001 11 212 333
002 15 545 3
select customid,
count(case status when 0 then status else null end) as status-0,
count(case status when 1 then status else null end) as status-1,
count(case status when 2 then status else null end) as status-2
from custom group by customid.

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



