title: Last_Value returning multiple records
body: <p>I have a table (SROEnquiry) as listed in the snapshot below:
  Data.jpg</p>
  
  <p>I’m using <code>Last_Value()</code> to get the last entry of each StudentNumberstudent on the table. StudentNumber 'Y1293926' is used as example.</p>
  
  <p>The script is as follows:</p>
  
  <pre><code>SELECT DISTINCT(StudentNumber),
         LAST_VALUE(Arrears) OVER 
         (PARTITION BY StudentNumber ORDER BY RecordID) AS LastValue  
  FROM SROEnquiry 
  WHERE StudentNumber = 'Y1293926'
  </code></pre>
  
  <p>The result is as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/ePY8l.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ePY8l.jpg" alt="enter image description here"></a></p>
  
  <p>The expected result is:</p>
  
  <pre><code>StudentNumber   LastValue
  Y1293926        0.00
  </code></pre>
  
  <p>What is wrong with the script that it brings back 4 values instead of only one?</p>