How to group rows and select top 1
<p>I am using a SQL Server CE database. I have a students fee table like :</p>

<p>Table <strong>dues</strong>:</p>

<pre><code>Erno  |   Date     |  Due   
---------------------------
1       1-Jan-2016    220
1       1-Mar-2016    200   
1       1-Apr-2016    210   
1       1-May-2016    200
2       1-Jan-2016    250   
2       1-Feb-2016    300   
2       1-Mar-2016    220   
2       1-Apr-2016    200   
3       1-Jan-2016    300
3       1-Feb-2016    150   
3       1-May-2016    400
3       1-Jun-2016    300
</code></pre>

<p>where <em>ErNo</em> is Enrollment no. and <em>Date</em> is deposit date and <em>Due</em> is balance of amount or fee up-to that date.</p>

<p>I want to get the latest record of every <code>Erno</code> or <code>Student</code>. </p>

<p>Like :</p>

<p>Latest Due information :</p>

<pre><code>   Erno        Date       Due
     1      1-May-2016    200   
     2      1-Apr-2016    200
     3      1-Jun-2016    300
</code></pre>

<p>Is there any SQL Server CE query to do so ?</p>