after some hours of trying i found this sql query with select
select a.grp, a.name, count(*) "rec"
from tab a, tab b
where b.grp = a.grp
and b.name <= a.name
group by a.grp, a.name;
with this result:
id grp name rec
-- --- ----- ---
1 a joe 1
2 a john 2
3 b james 1
4 b jill 2
5 b jim 3
6 c jack 1
7 d jesse 1
but how does an update work ?
PS: i'm using sas, a statistical software, in which i can use 'naked' sql