本文介紹了顯式連接語法的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我正在增強一個舊的應用程序,該應用程序使用與下面類似的查詢。我想轉換語法以開始使用顯式連接語法。下面的‘EXPLICIT JOIN語法’查詢是什么:
Select
DTL.DetailId
, HDR.PersonId
from
CMPN.Header HDR
, CMPN.Detail DTL
, CMPN.DetailStatus DST
, CMPN.AdjustmentsDetails CAD
where
HDR.HeaderId = DTL.HeaderId
and DTL.DetailId = DST.DetailId
and DTL.DetailId = CAD.DetailId
and DST.DetailStatusCode = 'Approved'
and DST.ExpirationTimestamp IS NULL
and HDR.Group = 'Group A'
;
推薦答案
試試:
SELECT
DTL.DetailId, HDR.PersonId
FROM
CMPN.Header HDR
INNER JOIN
CMPN.Detail DTL ON HDR.HeaderId = DTL.HeaderId
INNER JOIN
CMPN.DetailStatus DST ON DTL.DetailId = DST.DetailId
INNER JOIN
CMPN.AdjustmentsDetails CAD ON DTL.DetailId = CAD.DetailId
WHERE
DST.DetailStatusCode = 'Approved'
AND DST.ExpirationTimestamp IS NULL
AND HDR.Group = 'Group A';
這篇關于顯式連接語法的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,