Progressive count in a select

I've in SQL Server 7 a table grouppable where the key is X + Y.
I would like to do a SELECT ordered by X and Y with a column that give me a progressive count inside the field X. To explain better, I have to receive
X   Y   progr
a   a     1
a   b     2
b   a     1
b   b     2
b   c     3
and so on.
Someone know if I can obtain with only one SELECT?

p.s. please, excuse my english
Who is Participating?
Gustavo Perez BuenrostroConnect With a Mentor Commented:
Let me know if query below resolves your problem:

select x,y
      ,(select count(*)+1
          from YourTable
         where x=YT.x and y<YT.y) as prog
 from YourTable YT
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.