title: MySql LEFT JOIN within LEFT JOIN
body: <p>I am trying to do the following MySql query for a search box. I am trying to return the "Album" info (Title etc) while including a thumbnail of the first image in that album. However, I have to look up two tables to get the image info. First, the <code>photos_albums</code> that contain all the images in that album, get the first image <code>ID</code> from that table, then look up that image info in the <code>photos</code> table. I believe the problem I am having, is that I need to tell the first LEFT JOIN to limit the query to 1, but I have had no luck doing this. I think I need to do a JOIN within a JOIN? Any help on this would be much appreciated.</p>
  
  <pre><code>SELECT albums.title, albums.title_url, photos.path, photos.medType, photos.vpath
  FROM albums
  LEFT JOIN photos_albums
      ON photos_albums.album_id = albums.id
  LEFT JOIN photos
      ON photos_albums.photo_id = photos.id
  WHERE albums.user = '$site_user'
  AND (
      albums.title LIKE '$keyword%'
      OR albums.title LIKE '% $keyword%')
  LIMIT 6
  </code></pre>