gpt4 book ai didi

php - 不遵守Where子句

转载 作者:行者123 更新时间:2023-11-29 19:41:02 25 4
gpt4 key购买 nike

我在网上找到了以下 sql 查询,如果它正常工作那就完美了,但它不遵守 where 子句。

SELECT *
FROM Chicken AS a,
(SELECT MIN(Temp) AS mini, MAX(Temp) AS maxi
FROM Chicken
) AS m
WHERE m.maxi = a.Temp AND `Location` = "Outside" OR m.mini = a.Temp AND `Location` = "Outside"
ORDER BY `a`.`Time` DESC Limit 1

发生的情况是,无论位置如何,它都会承受最低和最高温度。我需要它来查找“室外”位置的最低和最高温度。

有人可以帮忙吗?

最佳答案

SELECT *
FROM Chicken AS a,
(SELECT MIN(Temp) AS mini, MAX(Temp) AS maxi
FROM Chicken
) AS m
WHERE (m.maxi = a.Temp AND `Location` = "Outside") OR (m.mini = a.Temp AND `Location` = "Outside")
ORDER BY `a`.`Time` DESC Limit 1

尝试一下这可能适合您。

关于php - 不遵守Where子句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41351811/

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