gpt4 book ai didi

mysql - 使用 HAVING 子句进行选择

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

我写了一个快速查询

select dno from Employee having max(salary)

在我的表中,最高薪水为 96000,与 dno 8 相关联。但由于某种原因,该 select 语句给出了 dno 6。

http://hastebin.com/wewahiloki.vhdl

我觉得这很明显,但我想不通。

最佳答案

没有分组依据就无法正常工作如果你想要所有最高薪水的 dno,你可以使用这个

select dno from Employee  where salary = (select max(salary) from Employee);

关于mysql - 使用 HAVING 子句进行选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36317590/

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