title: Fetching a Single Row from Join Table
body: <p>Here are my tables:</p>
  
  <pre><code>CREATE TABLE `articles` (
      `id` int(10) unsigned not null auto_increment,
      `author_id` int(10) unsigned not null,
      `date_created` datetime not null,
      PRIMARY KEY(id)
  ) ENGINE=InnoDB;
  
  CREATE TABLE `article_contents` (
      `article_id` int(10) unsigned not null,
      `title` varchar(100) not null,
      `content` text not null,
      PRIMARY KEY(article_id)
  ) ENGINE=InnoDB;
  
  CREATE TABLE `article_images` (
      `article_id` int(10) unsigned not null,
      `filename` varchar(100) not null,
      `date_added` datetime not null,
      UNIQUE INDEX(article_id, filename)
  ) ENGINE=InnoDB;
  </code></pre>
  
  <p>Every article can have one or more images associated with it. I'd like to display the last 40 written articles on a page, along with the most recent image associated with the article. What I can't figure out is how to join with the article_images table, and only retrieve a single row.</p>
  
  <p>Edit: It's important that the solution performs well. The solutions I've seen so far -- which use derived tables -- take a minute or more to complete.</p>