title: Three queries in one
body: <p>Is there a possibility to combine these 3 queries into on?
  I tried some queries but they gave me a wrong solutions. A <code>INNER JOIN</code> will not show rows if there's no post_id in the website_posts_photos table. </p>
  
  <p>I need all rows shown and per row the photo_code from website_posts_photos where <code>post_photo_order = 1 AS image1</code> AND <code>post_photo_order = 2 AS image2</code>.</p>
  
  <pre><code>$select_list = $database-&gt;prepare("SELECT post_id, post_title FROM website_posts WHERE post_status = '1' AND post_online = '1' ORDER BY post_date DESC LIMIT 50");
  $select_list-&gt;execute();
  
  while ($result = $select_list-&gt;fetch(PDO::FETCH_ASSOC)) {
       $post_id = $result['post_id'];
  
       $select_img1 = $database-&gt;prepare("SELECT photo_code FROM website_posts_photos WHERE post_photo_order = '1' AND post_id = :post_id");
       $select_img1-&gt;bindParam(':post_id', $post_id);
       $select_img1-&gt;execute();
       $result_img1 = $select_img1-&gt;fetch(PDO::FETCH_ASSOC);
  
       $select_img2 = $database-&gt;prepare("SELECT photo_code FROM website_posts_photos WHERE post_photo_order = '2' AND post_id = :post_id");
       $select_img2-&gt;bindParam(':post_id', $post_id);
       $select_img2-&gt;execute();
       $result_img2 = $select_img2-&gt;fetch(PDO::FETCH_ASSOC);     
  
  }
  </code></pre>