SQL SERVER 关于多层嵌套的方法


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  更新时间:

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM