title: Using Top in SQL Server 2012
body: <p>I have a table <code>Contacts</code>, parent to table <code>Activity</code>. I would like to select the latest activity for each contact, but getting more than one row.</p>
  
  <p>This is my query:</p>
  
  <pre><code>select top 30 
       * 
  from 
       Contacts o, Activity d  
  where 
       o.ID = d.contact 
       and d.ID &gt; 401061 
       and Last_Action is null 
  order by 
       d.activity_date desc
  </code></pre>
  
  <p>I think I need Top? but not sure how to implement here. Any help would be appreciated.</p>