gpt4 book ai didi

Mysql过滤SELECT查询结果。

转载 作者:行者123 更新时间:2023-11-29 06:42:15 25 4
gpt4 key购买 nike

我有以下查询。

SELECT COUNT(id) AS NumResults, race_date AS RaceDate, race_time AS RaceTime
FROM results
WHere jockeys_claim = 10
GROUP BY race_date DESC, race_time ASC

然后我想过滤掉 NumResults ,因此该表仅显示 NumResults = 1 的结果。感谢您的查看。

最佳答案

使用 HAVING 子句过滤聚合函数的结果(在您的情况下为 COUNT)

SELECT COUNT(id) AS NumResults, race_date AS RaceDate, race_time AS RaceTime
FROM results
WHere jockeys_claim = 10
GROUP BY race_date, race_time
HAVING COUNT(id) = 1
ORDER BY race_date DESC, race_time ASC

关于Mysql过滤SELECT查询结果。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51061564/

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