December 5, 2009 at 3:39 am
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
December 5, 2009 at 4:18 am
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
December 5, 2009 at 5:17 am
Thanks,
December 5, 2009 at 7:51 am
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