我寫我通過以下方式這兩個查詢有什麼區別?
UPDATE UPLOAD_TEMP
SET UPLOAD_TEMP.Borr_Add_Req = t2.YesNoResponse,
FROM UPLOAD_TEMP t1
INNER JOIN GB_RequiredFields t2 ON t1.State = t2.StateCode
AND t1.County_Id = t2.CountyId
AND t1.Group_code = t2.Doc_type_group_code
但是它也可以寫成這樣也
UPDATE UPLOAD_TEMP
SET UPLOAD_TEMP.Borr_Add_Req = t2.YesNoResponse,
FROM UPLOAD_TEMP t1
INNER JOIN GB_RequiredFields t2 ON t1.State = t2.StateCode
WHERE t1.County_Id = t2.CountyId
AND t1.Group_code = t2.Doc_type_group_code
連接查詢有兩個和之間的差額,以代碼的首選方式。
非常舊的風格加入。糟糕的做法。 – gbn 2009-11-23 10:55:45
我也不喜歡它,但誰說壞習慣?這對於DBMS來說並不重要,它只是爲了便於閱讀,而且主要受到過去如何做的影響。 – Pesse 2009-11-23 11:13:43
@Pesse:好吧,舊式外連接* = = *在SQL Server 2008之後已棄用,因此您將擁有完整的樣式錯誤。 – gbn 2009-11-23 19:35:31