hotcoder
hotcoder

Reputation: 3246

Get only second record from details table

I have a details table (AppID, SSN). I want to get only second where the record repeats. enter image description here

I have pointed with red the values that I want to get. Please tell me the query in MS SQL.

Upvotes: 0

Views: 499

Answers (1)

Royi Namir
Royi Namir

Reputation: 148524

edit

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

Related Questions