2020-09-01
阅读量:
1108
MySQL面试题:查询每个日期的胜负次数
record表结构如下:
请用SQL实现以下结果
create table record(
time0 datetime,
shengfu varchar(10));
insert into record(time0,shengfu)
values('2015-01-12 00:00:00.000','胜'),
('2016-12-09 00:00:00.000','负'),
('2013-05-22 00:00:00.000','胜'),
('2015-01-12 00:00:00.000','胜'),
('2013-05-22 00:00:00.000','胜'),
('2016-01-12 00:00:00.000','负');
select * from record;
select time0,sum(shengfu='胜') 胜,sum(shengfu='负') 负 from record group by time0 order by time0;






评论(0)


暂无数据
推荐帖子
1条评论
0条评论
0条评论