select a.id,b.id
from (select t1.id from test1 t1 where t1.xh = '123') a,
(select t2.id from test2 t2 where t2.xh = '456') b
where a.id = b.id(+)
select a.id,b.id
from test1 a,test2 b
where a.xh = '123'
and b.xh = '456'
and a.id = b.id(+)上面两条sql第一条可以得出b表(+)a表的数据,但是第二条得出的是两个表id相同的数据。
不明白原理,请各位给上一课。
from (select t1.id from test1 t1 where t1.xh = '123') a,
(select t2.id from test2 t2 where t2.xh = '456') b
where a.id = b.id(+)
select a.id,b.id
from test1 a,test2 b
where a.xh = '123'
and b.xh = '456'
and a.id = b.id(+)上面两条sql第一条可以得出b表(+)a表的数据,但是第二条得出的是两个表id相同的数据。
不明白原理,请各位给上一课。
Select * From(
select a.id aid,b.id bid
from (select t1.id from test1 t1 where t1.xh = '123') a,
(select t2.id from test2 t2 where t2.xh = '456') b
where a.id = b.id(+)
select a.id,b.id
from test1 a,test2 b
where a.xh = '123'
and a.id = b.id(+)
)
Where bid='456'