select * from A,AA,B,BB where A.id=AA.id and A.id=BB.id and A.id=B.id
------------------> A,AA,B,BB, select * from A,AA,B,BB where A.id=AA.id and B.id=BB.id and A.id=B.id 其中四个表的ID的值是相同的.这样查询出重复数据. 请问需要怎么样关联啊? ------------------> 应该选定一个表为主表,之后用外关联。如下:select * from A,AA,B,BB where A.id=AA.id(+) and A.id=BB.id(+) and A.id=B.id(+) 如果附表中有重复的数据需要先distinct各个表一下:select distinct * from A, (select distinct * distinct AA)t1, (select distinct * distinct B)t2, (select distinct * distinct BB)t3 where A.id=t1.id(+) and A.id=t2.id(+) and A.id=t3.id(+)
select * from A,AA,B,BB where A.id=AA.id and B.id=BB.id and A.id=B.id select * 啊,那是四个表的内容啊
select * from A,AA,B,BB where A.id=AA.id and B.id=BB.id and A.id=B.id 就可以关联拉! 要查出重复的id就用 select id from A,AA,B,BB where A.id=AA.id and B.id=BB.id and A.id=B.id group by id having count(*) > 1
where A.id=AA.id
and A.id=BB.id
and A.id=B.id
A,AA,B,BB,
select * from A,AA,B,BB where A.id=AA.id and B.id=BB.id and A.id=B.id
其中四个表的ID的值是相同的.这样查询出重复数据.
请问需要怎么样关联啊?
------------------>
应该选定一个表为主表,之后用外关联。如下:select * from A,AA,B,BB
where A.id=AA.id(+)
and A.id=BB.id(+)
and A.id=B.id(+)
如果附表中有重复的数据需要先distinct各个表一下:select distinct * from A,
(select distinct * distinct AA)t1,
(select distinct * distinct B)t2,
(select distinct * distinct BB)t3
where A.id=t1.id(+)
and A.id=t2.id(+)
and A.id=t3.id(+)
select * 啊,那是四个表的内容啊
就可以关联拉!
要查出重复的id就用
select id from A,AA,B,BB where A.id=AA.id and B.id=BB.id and A.id=B.id
group by id having count(*) > 1