INSERT INTO b表(a,b,c)
SELECT id,'你要插入的B字段','你要插入的c字段' FROM a表
select agentid,sum(good) as good,sum(normal) as normal,sum(bad) as badfrom
(select agentid,1 as good,0 as normal,0 as bad
from A where content=1
union all
select agentid,0 as good,1 as normal,0 as bad
from A where content=2
union all
select agentid,0 as good,0 as normal,1 as bad
from A where content=3
)B
group by agentid
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)