Skip to content Skip to sidebar Skip to footer

What Is The Difference Between These Two Queries?

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_Requi

Solution 1:

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.

Solution 2:

Both queries will have the same result and your sql-server should handle both in the same way. So there is no difference at all - just how you want to do it. You even can do it the following way:

UPDATE  UPLOAD_TEMP
    SET     UPLOAD_TEMP.Borr_Add_Req = t2.YesNoResponse,

    FROM    UPLOAD_TEMP t1, GB_RequiredFields t2
    WHERE
             t1.State = t2.StateCode
             AND t1.County_Id = t2.CountyId
            AND t1.Group_code = t2.Doc_type_group_code

Post a Comment for "What Is The Difference Between These Two Queries?"