SELECT
challenger_name as name,
IF(challenger_timeout > challenged_timeout,
(SET wins + 1),
NULL) as wins,
IF(challenger_timeout < challenged_timeout,
(SET lose + 1),
NULL) as lose,
IF(challenger_timeout = challenged_timeout,
(SET draw + 1),
NULL) as draw
FROM time_trial_challenge
GROUP by challenger_name ORDER by wins DESC";
如何修复此查询?
我希望你知道我想从这个查询中做些什么。 我很难将它们描述成句子
答案 0 :(得分:3)
SUM(IF(challenger_timeout > challenged_timeout,1,0)) as wins
...并对您的其他IF
答案 1 :(得分:2)
SQL无法在同一查询中执行UPDATE和SELECT。将其分为两个单独的查询。