title: SQL Distinct value over joined tables
body: <p>I am trying to get the <code>DISTINCT</code> value of one column in a table. This column however is INNER JOINED from another table through an <code>id</code>. </p>
  
  <p>When I try to use the <code>DISTINCT</code> on the column, it produces the same results because <code>DISTINCT</code> also takes into account the unique identifier ID. Is there any work around for this to just get the <code>DISTINCT</code> value of a column from a joined table???</p>
  
  <p>EG.</p>
  
  <pre><code>SELECT val1, b.val2, val3
    FROM TABLE 1 
    JOIN (SELECT DISTINCT val2 
            FROM TABLE 2) AS b ON val1 = b.val2
  </code></pre>