July 29, 2009 at 12:13 am
I have a small question, probably a silly one.. When we join 2 tables using left join like below:
select t1.*
from table1 as t1
left outer join table2 as t2
on t2.id = t1.id
Here, it will select all the rows of table1. Unless I am selecting any fields from table2, is there any need to do this left join at all? In what cases, left join is useful if we are not selecting anything from table2?
July 29, 2009 at 3:49 am
Hi gyessql,
Basically two or more tables should be joined only if the collective information from both the tables or on the basis of the criteria that involves fields from the tables (more than 1) is done.
If there is no possibility of selecting a single field from table2 then its recommended to not to join tables....
Thanks,
Amit
July 29, 2009 at 9:35 am
Duplicate post. Please post answers here
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
July 29, 2009 at 10:54 am
Amit H - Thanks for the clarification.
Jack - Thanks, I tried to delete the duplicated post but was not able to.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply