SQL 关于多层嵌套的方法
1、From 表
alter proc Pro_test1
as
select t1.*,t2.Name
from ( select * from Table1 )as t1
left join Table2 as t2 on t1.ID=t2.ID
--exec Pro_test1
2、in 和 exists
select * from table1 where zd1 in (select zd1 from table2 where zd1 <3);
--对比用法
select * from table1 where exists (
select * from table2 where zd1<3 and table2.zd1 = table1.zd1 ;
);
创建时间:2020.07.17 更新时间: