title: LEFT JOIN vs. multiple SELECT statements
body: <p>I am working on someone else's PHP code and seeing this pattern over and over:</p>
  
  <p>(pseudocode)</p>
  
  <pre><code>result = SELECT blah1, blah2, foreign_key FROM foo WHERE key=bar
  
  if foreign_key &gt; 0  
    other_result = SELECT something FROM foo2 WHERE key=foreign_key  
  end
  </code></pre>
  
  <p>The code needs to branch if there is no related row in the other table, but couldn't this be done better by doing a LEFT JOIN in a single SELECT statement? Am I missing some performance benefit? Portability issue? Or am I just nitpicking?</p>