SQL Join on Table with Duplicates, add condition to get unique values : <p>I need to join Table B to Table A using SQL in order to get Table B's column called "Reservoir".  They both have a unique ID to join on called "Well_ID" but the issue is that Table B has duplicate ids.  Table B has a column called "Qualifier" and another called "CreatedDate".  Qualifier "Dallas" has precedence over qualifier "Houston" and the latest CreatedDate is needed to find the unique Reservoir value.</p>

<p><a href="https://i.stack.imgur.com/biKhn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/biKhn.png" alt="enter image description here"></a></p>

<p>Since I'm unsure how to do the condition, all I have is the join statement so far: </p>

<pre><code>SELECT a.*
  ,b.[Reservoir] 
  ,b.[CreatedDateTime] 
  ,b.[Qualifier] 
FROM TableA a
INNER JOIN TableB b on a.Well_ID = b.Well_ID
</code></pre>
