一个sql查询?

[复制链接]
查看11 | 回复4 | 2007-9-26 18:42:10 | 显示全部楼层 |阅读模式
有两个表A,B,各一列
A:aa,bb,cc,dd,ee,ff
B:aa,cc,dd,gg.
写一个select 语句,查出两表中不同的列。
谢谢!
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
(select a from a
minus
select b from b)
union all
(select b from b
minus
select a from a)
;
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
select a from a where a.a not in (select * from b)
union
select b from b where b.b not in (select * from a);
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
各位多谢啦!
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
union,minus 都是啥意思?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行