select
时间,
SUM
(
case
when
win=
‘胜‘
then
1
else
0
end
) 胜,
SUM
(
case
when
win=
‘负‘
then
1
else
0
end
) 负
from
tb
group
by
时间
case相当于if.....else 条件语句
select
时间,
SUM
(
case
when
win=
‘胜‘
then
1
else
0
end
) 胜,
SUM
(
case
when
win=
‘负‘
then
1
else
0
end
) 负
from
tb
group
by
时间
case相当于if.....else 条件语句
原文:https://www.cnblogs.com/wy20110919/p/8729226.html