SELECT TIME 时间,
(SELECT COUNT(result) FROM game g WHERE result='胜' AND g.time=game.`time`) 胜,
(SELECT COUNT(result) FROM game g WHERE result='负' AND g.time=game.`time`) 负
FROM game GROUP BY TIME;
SELECT TIME 时间,
SUM(CASE WHEN result='胜' THEN 1 ELSE 0 END) 胜,
SUM(CASE WHEN result='负' THEN 1 ELSE 0 END) 负
FROM game GROUP BY TIME;
网友评论