SQL-Oracle-比较两个表中的3列

时间:2022-11-19 07:47:14

I have two tables: Tables A has columns 1, 2, 3. Table B has columns X, Y, Z. All columns are VARCHAR2(10).

我有两个表:表A有列1,2,3。表B有列X,Y,Z。所有列都是VARCHAR2(10)。

I need to compare columns 1 to X, columns 2 to Y, and columns 3 to Z, looking for all cases where 1,2,3 <> X,Y,Z.

我需要比较第1列到第X列,第2列到第Y列,第3列到第Z列,查找1,2,3 <> X,Y,Z的所有情况。

I have searched a number of articles on SO, and have not found what I'm looking for.

我搜索了很多关于SO的文章,并没有找到我正在寻找的东西。

Any assistance appreciated. Thank you.

任何协助赞赏。谢谢。

1 个解决方案

#1


0  

select a.1, a.2, a.3, b.x, b.y, b.z
from a cross join b
where
a.1 <> b.x and
a.2 <> b.y and
a.3 <> b.z

#1


0  

select a.1, a.2, a.3, b.x, b.y, b.z
from a cross join b
where
a.1 <> b.x and
a.2 <> b.y and
a.3 <> b.z