Subject | Re: Strange performance on a VIEW |
---|---|
Author | Adam |
Post date | 2005-07-29T05:38:53Z |
>as
> >Also because it is obviously a join across PKs, left join and join
> >will be identical,
>
> Oh no, join and left join are never identical. "JOIN" means the same
> "INNER JOIN". "LEFT JOIN" means the same as "LEFT OUTER JOIN".There is
> no such animule as a "LEFT INNER JOIN".Sorry Helen,
>
I should have clarified this statement
Left join different to join because left join will include all records
from the left and possibly leave nulls on the right. Inner joins only
include a record if it matches on both sides (ie no nulls).
In the case of this specific query
select ID, A, B, t2.C, sum(t2.D)
from table1 t1
left join table2 t2 on t1.ID = t2.ID
group by ID, A, B, C
I assume that T1.ID and T2.ID are both Primary keys. We have a few
scenarios of this where we have split certain tables for performance
reasons.
Now if every record in T1 has a sister record in T2 they are logically
equivalent, otherwise, you need to use left join.
I will take a look at the SQL Ben posted later to see if it tells me
anything.
Adam