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