Reputation: 955
I've the following table
and I want to come up with the following table
What I want is to select rows with largest version of each client. Tahnks in advance.
Upvotes: 0
Views: 537
Reputation: 7189
select * from
(
select *,rn=Dense_rank()over(partition by Clientid order by version desc) from table
)x
where x.rn=1
Upvotes: 0
Reputation: 28413
Try this
SELECT * From Table1 T
JOIN (SELECT clientid,Max(version) As MVer
From Table1 Group By clientid) S
ON T.clientid = S.clientid And T.version = S.MVer
Upvotes: 4