select * from dic a,
(select dic.col from dic , a where dic.col = a.col) union all
(select dic.col from dic , a where dic.col = b.col) union all
(select dic.col from dic , a where dic.col = c.col) union all
(select dic.col from dic , a where dic.col = d.col) union all
(select dic.col from dic , a where dic.col = e.col) )b
where a.col<>b.col
(select dic.col from dic , a where dic.col = a.col) union all
(select dic.col from dic , a where dic.col = b.col) union all
(select dic.col from dic , a where dic.col = c.col) union all
(select dic.col from dic , a where dic.col = d.col) union all
(select dic.col from dic , a where dic.col = e.col) )b
where a.col<>b.col
select * from dic a,
((select dic.col from dic , a where dic.col = a.col) union all
(select dic.col from dic , b where dic.col = b.col) union all
(select dic.col from dic , c where dic.col = c.col) union all
(select dic.col from dic , d where dic.col = d.col) union all
(select dic.col from dic , e where dic.col = e.col) )b
where a.col<>b.col答案不对啊,取出了那几亿条数据.
( select B.ID from B)
要对两个表进行全表扫描,你在sqlplus中看一下查询计划就知道了
sql server 也有类似的,就是QA(查询分析器)
要在sqlplus 中查看查询计划,要生成一个planTable的表,具体
我就不多说了,这样的帖子太多了 最后说一句,很多人都回答了你的问题,楼主还没给分!
呵呵
(
select a.col from a
union
select a.col from b
union
select a.col from c
union
select a.col from d
union
select a.col from e
) t2
where t1.col<>t2.col;
dic.col不在a, b, c, d, e表里的dic记录吧