Pulling Earliest Record of a Group of Transactions

What is the best way to query a table and pull the every first transaction for each customer?

What is your table structure?

SELECT *
FROM
(
    SELECT *, RN = ROW_NUMBER() OVER (PARTITION BY CUSTOMER ORDER BY TRANSACTION_DATE)
    FROM   a_table
) D
WHERE D.RN = 1
1 Like