title: Merge two tables by two variables in SQL Server
body: <p>I have two tables that I want to merge by the two common variables.</p>
  
  <p>So I have
  Table1</p>
  
  <pre><code>Var1       Var2       Dates      
  ---------- ---------- ----------------------
  111111     AA          1990-06-20
  111111     AA          2000-06-20
  222222     BB          1963-06-20
  222222     BB          2005-06-20
  333333     CC          2006-06-30
  333333     CC          2016-06-26
  </code></pre>
  
  <p>and Table2</p>
  
  <pre><code>Var2       Dates      
  ---------- ----------------------
  AA          1990-06-20
  BB          1963-06-20
  </code></pre>
  
  <p>I want the output to be</p>
  
  <pre><code>Var1       Var2       Dates      
  ---------- ---------- ----------------------
  111111     AA          1990-06-20
  222222     BB          1963-06-20
  </code></pre>
  
  <p>I have tried inner join two times using "Var2" and "Dates" in two tables. But the results gave me more rows (duplicate entries) than I need. </p>