From the snippet of your table definition and records shown this should work but might need some slight modification if they are more involved. I’m assuming User1 to 4 is a unique id.
select a.Col1,
(select count(distinct b.Col1) from Tablename b
where (a.Col1 >= b.Col1)) as Col2
from Tablename a
order by a.Col1
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.