Reputation: 3246
I have a details table (AppID, SSN). I want to get only second where the record repeats.
I have pointed with red the values that I want to get. Please tell me the query in MS SQL.
Upvotes: 0
Views: 499
Reputation: 148524
select AppID, SSN ,rn from (
select AppID, SSN , row_number() over(partition by AppID order by AppID) as rn from Table
)T where rn=2
Upvotes: 1