Q&A for Ubuntu users and developers
declare @t table ([Name] varchar(1), Amount int) insert into @t values ('a', 100) insert into @t values ('b', 300) insert into @t values ('c', 250) select name , amount , row_number() over (partition by Amount order by Amount) from @t