gpt4 book ai didi

mysql - 在 MySQL 中使用 UNION 限制

转载 作者:行者123 更新时间:2023-11-29 04:18:20 25 4
gpt4 key购买 nike

我想选择以下记录,但使用单个或组合查询

  1. 我要选择薪水为100的所有记录
  2. 我只想选择薪水为200的前50条记录

我想使用单个或组合查询收集所有记录并一次显示总记录

我尝试跟随但没有成功

SELECT salary FROM ( SELECT salary FROM salaries WHERE salary= 200 limit 50 ) salaries WHERE salary= 100

谁能帮帮我

最佳答案

SELECT * FROM salaries WHERE salary = 100 
UNION
(SELECT * FROM salaries WHERE salary= 200 limit 50)

试试这个包括支架。希望这会有所帮助。

关于mysql - 在 MySQL 中使用 UNION 限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33686143/

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