title: How to select rows from two tables using sql
body: <p>I want to select rows from table A where <code>UserId=1</code> and table B where <code>UserName=xxx</code>. </p>
  
  <p>If the rows from A and B are same, we can use group.</p>
  
  <p><strong>Table A</strong></p>
  
  <pre><code>Session    UserId
  -----------------
  1           1
  2           2
  </code></pre>
  
  <p><strong>Table B</strong></p>
  
  <pre><code>Session    Username
  -------------------
  1           xxx
  11          xxx
  12          xxx
  </code></pre>
  
  <p><strong>User table</strong></p>
  
  <pre><code>UserId    Username
  ------------------
  1         xxx
  </code></pre>
  
  <p>Now I want to get rows from table a <code>where userid = 1</code> and from table b <code>where username = xxx</code>. If the session from a and b are same, we can group it.</p>
  
  <pre><code>Session
  ==========
  1
  11
  12
  </code></pre>