I have a table named TransList with the following columns:
ID Int (Identity column)
The TransNum is not unique and can be repeating the same value many times. Only the ID is unique. I would like to do a query that shows only the rows for the first occurrence of each TransNum. Here is what I did:
SELECT * FROM TransList T
WHERE ID = (SELECT MIN(ID) FROM TransList WHERE TransNum = T.TransNum)
I'm not sure if my query is efficient or not. Could you please comment and maybe suggest a better way that would run faster?
Thank you so much in advance for your much appreciated help!