title: Left Joining Three tables with Subquery
body: <p><a href="http://sqlfiddle.com/#!2/f137a/57" rel="nofollow">Check this fiddle for DB and tables</a></p>
  
  <pre><code>SELECT p.*
  FROM Products p
  LEFT JOIN offertran ot 
  ON p.prod_id = ot.prod_id
  LEFT JOIN Offers o
  ON ot.offer_id =  (SELECT id FROM Offers 
                     Where dF&lt;=3 AND dt&gt;=3)
  
  ORDER BY o.id DESC, 
            p.prod_id ASC
  LIMIT 20
  </code></pre>
  
  <p>The Output is:</p>
  
  <pre><code>| PROD_ID | CATEGORY_ID | PROD_NAME |  BRAND | PRICE | STATUS |
  ---------------------------------------------------------------
  |      p3 |          c1 |     prod3 | brand3 |  3000 | active |
  |      p3 |          c1 |     prod3 | brand3 |  3000 | active |
  |      p1 |          c1 |     prod1 | brand1 |  1000 | active |
  |      p2 |          c2 |     prod2 | brand2 |  2000 | active |
  |      p4 |          c2 |     prod4 | brand1 |  4000 | active |
  |      p5 |          c1 |     prod5 | brand2 |  5000 | active |
  |      p6 |          c2 |     prod6 | brand3 |  6000 | active |
  </code></pre>
  
  <p>But, here as you can see <code>p3</code> is shown two times. I dont know why..
  I had tried all the possible ways but I cant find any remedies.. :(</p>