title: Join Two Tables based on a third table's data
body: <p>I have 3 tables, for the sake of this exercise we'll call them: Products, Price, and Discount. I'm trying to join Products and Price tables, only if the ProductID is found in Discount.ProductID (ProductID column within the Discount table).</p>
  <p>Products:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">ProductID</th>
  <th style="text-align: center;">Size</th>
  <th style="text-align: right;">Color</th>
  <th style="text-align: right;">Ref#</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">A1234</td>
  <td style="text-align: center;">Small</td>
  <td style="text-align: right;">Blu</td>
  <td style="text-align: right;">0C94</td>
  </tr>
  <tr>
  <td style="text-align: left;">B5678</td>
  <td style="text-align: center;">Med</td>
  <td style="text-align: right;">Red</td>
  <td style="text-align: right;">1D96</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Price:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">Ref#</th>
  <th style="text-align: center;">Base</th>
  <th style="text-align: right;">Tax</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">0C94</td>
  <td style="text-align: center;">3.48</td>
  <td style="text-align: right;">0.96</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Discount:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">ProductID</th>
  <th style="text-align: left;">List</th>
  <th style="text-align: right;">Site</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">A1234</td>
  <td style="text-align: left;">Two</td>
  <td style="text-align: right;">Three</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I'm familiar with joins, so my code starts off as:</p>
  <pre><code>SELECT * FROM Product as a
  left join Price as b
  on a.Ref# = b.Ref#
  </code></pre>
  <p>but I've never nested a constraints within a where clause (if that's even the correct approach) based on a third table. Any advice would be greatly appreciated. The end result would be a new products table that only shows the one product, because ProductID B5678 is not in the Discount table.</p>