What is the difference between these two queries?

sql, sql-server

Solution

That's an age-old argument - whether to specify additional WHERE arguments in the JOIN clause or as a separate WHERE.

I prefer the approach of defining only those arguments that really make up the JOIN inside the JOIN clause, and everything else later on in the WHERE clause. Seems cleaner to me.

But I think in the end, functionally, it's the same - it's just a matter of personal preference, really.

Problem

I am writing my join query by the following way ``` 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 ``` However it can also be written this way as well ``` 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 ``` IS there any difference between both and which is the preferred way to code.

Original source