sql where exist

1

SELECT  
                *
            FROM Doc_AllotOrder rt
            WHERE EXISTS( 
                SELECT * 
                FROM (
                    SELECT distinct
                         t1.DocEntry
                        ,t1.SONum
                        ,t1.CustPONum,
                        t1.Brand,
                        t1.DueDate,
                        t0.DocDate            
                    FROM dbo.Doc_AllotOrder t0 '+@sqlWhere+'
                ) as res2  WHERE DocEntry in(2,3,6) and DocEntry=rt.DocEntry  AND SONum=rt.SONum .......
            )

 

posted @ 2021-02-25 10:33  waityu  阅读(567)  评论(0编辑  收藏  举报