sqlserver_delete from from inner join_通过表关联查询删除

2022/9/17 2:18:31

本文主要是介绍sqlserver_delete from from inner join_通过表关联查询删除,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

直接上SQL语句:

 

DELETE FROM TJ_TB_Order FROM dbo.TJ_TB_Order O 
INNER JOIN (SELECT * FROM (
    SELECT OriginID,OriginSiteID,COUNT(1) c,MAX(ID) ID FROM TJ_TB_Order GROUP BY OriginID,OriginSiteID
) A WHERE A.c>1) B ON O.OriginID=B.OriginID AND O.OriginSiteID=B.OriginSiteID AND O.ID=B.ID

 



这篇关于sqlserver_delete from from inner join_通过表关联查询删除的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程