gpt4 book ai didi

mysql - 通过逻辑表达式选择mysql字段

转载 作者:行者123 更新时间:2023-11-29 01:33:50 27 4
gpt4 key购买 nike

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";

如何修复这个查询?

我希望你知道我想从这个查询中做什么。我很难用句子来描述它们

最佳答案

SUM(IF(challenger_timeout > challenged_timeout,1,0)) as wins

...并对您的其他 IF 执行相同的操作

关于mysql - 通过逻辑表达式选择mysql字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3308259/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com