title: How to Select Data From Multiple Tables using inner join statment?
body: <p>I have three tables</p>
  
  <p>Products Table :</p>
  
  <p><code>
       ID
       GeneralStockEnabled
       RetailerID
  </code></p>
  
  <p>Sources Table</p>
  
  <p><code>
       ID
       Name
       RetailerID
  </code></p>
  
  <p>and </p>
  
  <p>ProductInventory Table </p>
  
  <p><code>
       ProductID
       SourceID
       Stock
  </code></p>
  
  <p>The user will pass both the @RetailerID and @ProductID in my Stored Procedure. </p>
  
  <p>How Can I select All the sources for particular retailer and attach the stock value coming from the product inventory table to those sources exists in the product inventory table for a particular product id and also select the value of GeneralStockEnabled for that product? . Even I my product has no stocks, I still want to be able to retrieve all the sources for that retailer?. </p>
  
  <p>Any Help is appreciated.</p>
  
  <p>I have this SQL right now :</p>
  
  <pre><code>SELECT S.ID AS SourceID,S.Name AS SourceName,PIN.Stock
  FROM Sources S
       LEFT OUTER JOIN ProductInventory PIN
       ON (S.ID = PIN.SourceID)
  WHERE S.RetailerID = 1
  AND PIN.ProductID = 1 
  </code></pre>
  
  <p>but since my product inventory table has no records now. It is not selecting the left part which are the sources in this case. </p>