insert into tab1(col1,col2)
select tab2.co1,tab2.co2 from tab2 where exists
(select 'X' from tab3
where tab2.co3 = tab3.co3)
select tab2.co1,tab2.co2 from tab2 where exists
(select 'X' from tab3
where tab2.co3 = tab3.co3)
这样试试:
insert into tab1(col1,col2)
select col1=tab2.co1,col2=tab2.co2 from tab2 join tab3 on tab2.co3=tab3.co3
select tab2.co1,tab2.co2 from tab2,tab3 where tab2.co3=tab3.co3