日期:2014-05-18 浏览次数:20469 次
--如下联合---没有问题, select t1.id,t1.data,t2.data from table1 t1 ,table2 t2 where t1.id=t2.id; --如果当其中一个表是 复合表时就不行了, --就是说,当其中一个表是子查询时就不行了 --如下: select * from table1 as t1, select *from ( select t2.id ,t2.data, t3.data from table2 as t2,table3 as t3 where t2.id=t3.id )as tab where t1.id=tab.id;
select * from table1 as t1, where t1.id in ( select t2.id from table2 as t2,table3 as t3 where t2.id=t3.id )
------解决方案--------------------
select * from table1 as t1, select *from ( select t2.id ,t2.data as data1, t3.data as data2 from table2 as t2,table3 as t3 where t2.id=t3.id )as tab where t1.id=tab.id;
------解决方案--------------------