sql in not in 案例用 exists not exists 代替

SELECT distinct code  FROM Stoke  where Bigcode in (select Opencode from AppStoke)
SELECT distinct code FROM Stoke A where exists (select 1 from AppStoke B WHERE B.Opencode=A.Code)

  in用extist代替

 select distinct * from Stoke where Code not in (select Code From AppStoke)
 select distinct * from Stoke  A where  not EXISTS (select 1 From AppStoke B WHERE B.OpenCode=A.Code)

not  in  用 not extist 代替

Update SCALE set State='已入库' WHERE  Code in (select OpenCode from AppStore) 
    
 Update SCALE  set State='已入库' WHERE  EXISTS (select 1 from AppStoreS WHERE S.OpenCode=Code)

 

posted @ 2018-09-07 10:52  蜜雪粮液  阅读(419)  评论(0编辑  收藏  举报