2021年6月29日 星期二

MS-SQL 2資料表檢查不存在的資料及刪除

 MS-SQL 2資料表檢查不存在的資料

select no from AA where (select COUNT(0) from BB where no=AA.no)=0


同理

要刪除不存在的,調整一下即可

delete from AA where (select COUNT(0) from BB where no=AA.no)=0

2021年6月16日 星期三