title: SQL Server - Select first row that meets criteria
body: <p>I have 2 tables that contain IDs. There will be duplicate IDs in one of the tables and I only want to return one row for each matching ID in table B. For example:</p>
  
  <p>Table A</p>
  
  <pre><code>+-----------+-----------+
  | objectIdA | objectIdB |
  +-----------+-----------+
  |         1 |         A | 
  |         1 |         B | 
  |         1 |         D | 
  |         5 |         F | 
  +-----------+-----------+
  </code></pre>
  
  <p>Table B</p>
  
  <pre><code>+-----------+
  | objectIdA |
  +-----------+
  |         1 |
  |         5 |
  +-----------+
  </code></pre>
  
  <p>Would return:</p>
  
  <pre><code>+-----------+-----------+
  | objectIdA | objectIdB |
  +-----------+-----------+
  |         1 |         D | 
  |         5 |         F | 
  +-----------+-----------+
  </code></pre>
  
  <p>I only need one entry from Table A that matches Table B. It doesn't matter which row of table A is returned.</p>
  
  <p>I'm using SQL Server.
  Thanks.</p>