title: Select table with subquery
body: <p>i try to list out all products with product images, but not sure how to use <code>subquery</code> in this situation. Below is my database structure</p>
  
  <p>products</p>
  
  <pre><code>products_id + product_name +
      1       |    Apple     |
      2       |    Banana    |
  </code></pre>
  
  <p>products_screenshot</p>
  
  <pre><code>products_id +       images       +
      1       |    Apple-1.jpg     |
      1       |    Apple-2.jpg     |
      1       |    Apple-3.jpg     |
      2       |    Banana-1.jpg    |
      2       |    Banana-2.jpg    |
      2       |    Banana-3.jpg    |
  </code></pre>
  
  <p>this is my query:</p>
  
  <pre><code>$sql = "SELECT p.* FROM `products` p ORDER BY p.products_id ASC ";
  
  //LEFT JOIN (SELECT ps.* FROM `products_screenshot` ps WHERE ps.products_id=p.products_id) AS pss ON(p.products_id=pss.products_id)
  
  $query = $db-&gt;query($sql);
  
  while ($row = $query-&gt;fetch_object()) {
  
       // result
       echo $row-&gt;products_name.'&lt;/br&gt;';
  
       // list all product screenshot related with this 
       //$row-&gt;images
  
  }
  </code></pre>