[oracle]"与作为......"在 SQL 导航

标签: sql Oracle
发布时间: 2017/4/15 18:57:19
注意事项: 本文中文内容可能为机器翻译,如要查看英文原文请点击上面连接.

下面的查询工作︰

select count(*) from everything where num not in (select num from sometable)

下面的查询应该是相当于以上所述,但在"无效标识符"错误的结果︰

with unwanted as (select num from sometable)
select count(*) from everything where num not in unwanted

第二个查询出了什么错误?

解决方法 1:

语法是这样的︰

with unwanted as (select num from sometable)
select count(*) from everything where num not in (select * from unwanted)

很明显这是唯一的有道理,如果 select num from sometable 是有点更复杂或使用几次以后...

赞助商