Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Oracle SQL 中,为什么这段代码不能编译?Oracle 不支持相交?intersect 只取一列值?
假设两个表具有相同的列类型。
谢谢
select B.name, B.id from tmp_B B where B.id in (select distinct id from tmp_A); intersect select distinct A.name, A.id from tmp_A A;
错误信息
Error report: Unknown Command
您的语句中有语法错误。SELECT在首字母之后和 . 之前有一个额外的分号INTERSECT。
SELECT
INTERSECT
select B.name, B.id from tmp_B B where B.id in (select distinct id from tmp_A) intersect select distinct A.name, A.id from tmp_A A
应该是一个有效的 SQL 语句,假设在两个表ID中NAME具有相同的数据类型。
ID
NAME