gpt4 book ai didi

sql - 如何在另一个 SQL 语句中使用输出

转载 作者:行者123 更新时间:2023-12-04 20:04:51 24 4
gpt4 key购买 nike

我有以下声明:

select region_id from regions
where region_name = 'Europe'

我需要以下语句中的输出,其中 'bla' 是:
select count(*) from countries
where region_id = 'bla'

我怎样才能做到这一点?

最佳答案

试试 IN clause

select distinct * from countries
where region_id IN (select region_id from regions
where region_name = 'Europe')

关于sql - 如何在另一个 SQL 语句中使用输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7271588/

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