已知表内容:
要求写sql输出以下内容:
------------------------------------------------
create table winfail(
time varchar(10),
result char(1)
);
insert into winfail values('2005-05-09','胜');
insert into winfail values('2005-05-09','胜');
insert into winfail values('2005-05-09','负');
insert into winfail values('2005-05-09','负');
insert into winfail values('2005-05-10','胜');
insert into winfail values('2005-05-10','负');
insert into winfail values('2005-05-10','负');
-------------------------------------------------
SELECT time 时间,
COUNT(CASE result WHEN '胜' THEN 1 END)胜,
COUNT(CASE result WHEN '负' THEN 1 END)负
FROM winfail GROUP BY time;