1.比赛结果result表内容如下
Date Win
2017-07-12 胜
2017-07-12 负
2017-07-15 胜
2017-07-15 负
如果要生成下列结果,正确的sql语句是:
比赛日期 胜 负
2017-07-12 1 1
2017-07-15 1 1
SELECT Date as 比赛日期,sum(case when win='胜' then 1 else 0 end)胜,sum(case when win='负' then 1 else 0 end)负 FROM new_schema.result group by Date;