title: Join two tables in SQL and select certain columns
body: <p>I have a table <code>contacts</code> which has the PK fields <code>name</code> and <code>idref</code>
  and another table called <code>links</code> that has the PK fields <code>contactFK</code>, <code>type</code> and <code>groupid</code></p>
  
  <p>For example </p>
  
  <pre><code>contacts 
  
  pk     name    idref
  1      john     5634
  2      jen      4525
  3      james    5656
  
  links
  
  pk     contactfk    type       groupid
  1          1        primary    555
  2          2        worker     555
  3          3        primary    666
  </code></pre>
  
  <p>I want to show</p>
  
  <pre><code>name  id    groupid primaryid
  john  5634  555     5634
  jen   4525  555     5634
  james 5656  666     5656
  </code></pre>