title: Top clause in SQL server
body: <p>Data:</p>
  
  <pre><code>User ID       | plan           | effective date.  |  package
  1.            | P1             |  24-05-2017      |  2017
  1.            | P1             |  01-06-2017      |  2017
  1.            | P2             |  01-07 2017      |  2017
  </code></pre>
  
  <p>If plan changes - select plan most recent effective date
  In above case: I get it by top clause order by date desc</p>
  
  <p>If plan does not change, both are p1 rows, suppose only first 2 rows are there, I have to select 25-05-2017 date row.</p>
  
  <p>Trying to check previous year plan is same or not with last row.</p>