View Single Post
  #5 (permalink)  
Old 10-14-09, 09:30
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
There are two reasons I prefer not to use left join for this.
1) Accuracy: If these are 1:m relationships then you will\ can get duplicates in your results.
2) Consistency: I consistently code my SQL so that tables ONLY appear in the FROM clause if I am actually reading data from those tables. If their only purpose is to establish whether or not a record exists then it goes in the EXISTS clause. To parse this query you need to cross reference the WHERE clause with the FROM clause to establish exactly what is going on here and that there are no redundant joins. Also, the reverse of this query would now only require changing of EXISTS to NOT EXISTS. Reversing your query would take a lot more changes. Obviously it does not look like it applies for this particular requirement.
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote