gpt4 book ai didi

mysql - 我该如何完成这个查询?

转载 作者:行者123 更新时间:2023-11-29 01:44:28 25 4
gpt4 key购买 nike

select * from workers where id = uid and age = uage`   -- sql1
select uid,uage from users where uage>20` -- sql2

我想用sql2作为sql1的条件,即uiduagesql1 来自sql2

最佳答案

您可以连接两个表:

SELECT w.*
FROM workers w
INNER JOIN users u
ON w.id = u.uid AND w.age = u.uage
WHERE u.uage > 20

关于mysql - 我该如何完成这个查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10637359/

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