title: How to join data from multiple table keeping all distinct values
body: <p>I have three tables :</p>
  <p><strong>article :</strong></p>
  <pre><code>idArticle
  libArticle
  </code></pre>
  <p><strong>stock :</strong></p>
  <pre><code>idArticle
  idWarehouse
  qtyStock
  </code></pre>
  <p><strong>warehouse :</strong></p>
  <pre><code>idWarehouse
  libWarehouse
  </code></pre>
  <p>In the table stock, I only have the article available
  So, for exemple, if the data are :</p>
  <p><strong>article :</strong></p>
  <pre><code>890001 'Article1'
  890002 'Article2'
  </code></pre>
  <p><strong>warehouse :</strong></p>
  <pre><code>0001 'Warehouse Est'
  0002 'Warehouse West'
  0003 'Warehouse South'
  </code></pre>
  <p><strong>stock :</strong></p>
  <pre><code>890001 0001 50
  890001 0002 30
  890002 0003 20
  </code></pre>
  <p>I want to make a request which display the qtyStock for each article, with &quot;0&quot; in qtyStock if there is not in stock, AND a line for each warehouse, like :</p>
  <pre><code>890001 0001 50
  890001 0002 30
  890001 0003 0
  890002 0001 0
  890002 0002 0
  890002 0003 20
  </code></pre>
  <p>I tried :</p>
  <pre><code>select a.idwarehouse, a.idarticle, s.qtystock  from 
  (
  select idwarehouse, idarticle
  from article, warehouse
  where idarticle IN ('890001', '890002')
  ) a 
  left join stock s on a.idwarehouse = s.idwarehouse and a.idarticle = s.idarticle
  </code></pre>
  <p>It works, but is there a better way to do it without that kind of subrequest ?</p>