文章详情页
关于Mysql数据表行转列
浏览:205日期:2022-06-13 14:39:16
问题描述
问题解答
回答1:试试下面的语句:
select team_name,sum(if(score=’正’,1,0)) as’正’,sum(if(score=’负’,1,0)) as ’负’ from teamscore group by team_name;回答2:
应该是:
SELECT team_name, count(*) AS win WHERE score = ’正’ GROUP BY team_nameSELECT team_name, count(*) AS loss WHERE score = ’负’ GROUP BY team_name
再想办法把这两个结果合起来。
相关文章:
排行榜

网公网安备