Oracle SQL 工作表
我正在尝试比较两列,目标是返回不匹配的行。例如,我在第 1 列和第 2 列中,下面是
1 2
id name age job id name age job
1 aaa 11 bbb 1 aaa 11 bbb
2 ccc 22 ddd 2 ccc 22 eee
我正在寻找的返回值,
2 ccc 22 ddd
2 ccc 22 eee
我正在尝试使用以下内容
select id, name, age from 1 where id in
(
select id, name, age from 1
minus
select id, name, age from 2
)
union all
select id, name, age from 2 where id in
(
select id, name, age from 1
minus
select id, name, age from 2
)
order by id
,我收到以下错误
ORA-00913: demasiados valores
00913. 00000 - "too many values"
*Cause:
*Action:
Error at Line: 6 Column: 1
Thatrefers the line with the 1st (
Any help将不胜感激。
I'm trying to compare 2 columns and the goal is the return of the lines that don't match. For example I have in column 1 and 2 the following
1 2
id name age job id name age job
1 aaa 11 bbb 1 aaa 11 bbb
2 ccc 22 ddd 2 ccc 22 eee
the return I'm looking for is
2 ccc 22 ddd
2 ccc 22 eee
I'm trying to use the following
select id, name, age from 1 where id in
(
select id, name, age from 1
minus
select id, name, age from 2
)
union all
select id, name, age from 2 where id in
(
select id, name, age from 1
minus
select id, name, age from 2
)
order by id
I get the following error
ORA-00913: demasiados valores
00913. 00000 - "too many values"
*Cause:
*Action:
Error at Line: 6 Column: 1
That refers to the line with the 1st (
Any help would be very appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您收到的具体错误是由于以下原因造成的:
您不能使用 in 子句将 ID 的单个值与其他 3 个值进行比较。
The specific error you are getting is because of the following:
You can not use an in clause to compare a single value of ID to 3 other values.