title: Select query for particular column value
body: <p>I have two tables like the following.  How can I query this to join these two tables?  I need to implement this in one query.  </p>
  
  <p>Table1</p>
  
  <pre><code> Id  name mark     
  ---  ---- ----   
  1   name1 40    
  2   name2 30   
  3   name3 20  
  4   name4 80 
  </code></pre>
  
  <p>Table2</p>
  
  <pre><code>details_id    address userid  
  ----------    ------- ---
   1            A1      user=2
   2            dd      user=3
   3            gg      user=1
   4            kk      user=4
  </code></pre>
  
  <p>I need to join these tables using id and userid in both tables.</p>
  
  <pre><code>select * from table1 left join table2 on table1.id = table2.userid
  </code></pre>