title: Change Data Capture- Get only distinct latest changes
body: <p>I am trying to find all the distinct and latest changes only from a certain change data capture table. Here is the snap shot of the table.
  <a href="https://i.stack.imgur.com/nycbU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nycbU.png" alt="enter image description here"></a></p>
  
  <p>I tried to use this query:</p>
  
  <pre>
  select DISTINCT StudentUSI, sys.fn_cdc_map_lsn_to_time(__$start_lsn) TransactionTime, __$operation Operation, LastModifiedDate 
  from cdc.Student_CT
  where __$operation in (1,2,4)
  ORDER BY StudentUSI;
  </pre>
  
  <p>But the returned result is:</p>
  
  <p><a href="https://i.stack.imgur.com/7tQwb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7tQwb.png" alt="enter image description here"></a></p>
  
  <p>Also if I try to use GROOUP BY, it says:</p>
  
  <blockquote>
    <p>Column 'cdc.Student_CT.__$start_lsn' is invalid in the select list
    because it is not contained in either an aggregate function or the
    GROUP BY clause.</p>
  </blockquote>
  
  <p>Is there any other way I could just get the most latest change with respect to the StudentUSI value? 
  Thank you!</p>