• Hi, Change @t to your table name and your columns for id, amount, adate

    WITH cte AS

    (

    SELECT ROW_NUMBER() OVER (PARTITION BY id ORDER BY adate desc) AS ROW,

    id,

    amount,

    adate

    FROM @t

    )

    SELECT *

    FROM cte

    where Row = 1

    this should work fine.