mysql查询日期胜负_MySQL面试题:查询每个日期的胜负次数
生活随笔
收集整理的這篇文章主要介紹了
mysql查询日期胜负_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;
總結
以上是生活随笔為你收集整理的mysql查询日期胜负_MySQL面试题:查询每个日期的胜负次数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: is this mysql server
- 下一篇: 排骨多少钱一斤啊?