Query of INNER Join

  • Just wanted to check is there any kind of difference if we apply "where" clause along with Join condition. Below mentioned query will give the Idea. Check out for T.BUS_NAME like 'PE%'. Its giving the same no of rows with same execution time but still I wanted to check if there is any technical difference which I dont know.

    Query 1

    =============

    SELECT T1.*

    FROM Table1 T1

    INNER JOIN Table2 T2

    ON T1.BUS_ID = T2.BUS_ID

    INNER JOIN Table3 T3

    ON T3.PROJID = T1.PROJID

    WHERE T2.BUS_NAME LIKE 'PE%'

    Query 2

    =============

    SELECT T1.*

    FROM Table1 T1

    INNER JOIN Table2 T2

    ON T1.BUS_ID = T2.BUS_ID AND T2.BUS_NAME LIKE 'PE%'

    INNER JOIN Table3 T3

    ON T3.PROJID = T1.PROJID

  • Not in an inner join. In an outer they may produce different results

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks,

  • this did confuse me when i first started getting different results in a left join

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply