title: SELECT 5 most recent SQL Server
body: <p>I have a table with records like this:</p>
  
  <pre><code>id        timestamp               dose             drug_id
  1     2012-10-04 09:10:54          05                 2
  1     2012-10-04 09:12:34          15                 2
  1     2012-10-04 09:15:12          20                 2
  1     2012-10-04 09:35:32          25                 2
  1     2012-10-04 09:37:34          25                 2
  1     2012-10-04 09:39:24          25                 2
  1     2012-10-04 09:42:16          35                 2
  1     2012-10-04 09:43:07          35                 2
  </code></pre>
  
  <p>What I want to do is select the last 5 used dose values for a given drug, so in this case the query should return <strong>35, 25, 20, 15, 05</strong>.</p>
  
  <p>I know I can use TOP and ORDER BY to get the latest 5 entries, but in this case it would return duplicates (35, 35, 25, 25, 25).</p>
  
  <p>What should I use to get the output I want?</p>