Row Number for group by ?
Posted
by
Damien Joe
on Stack Overflow
See other posts from Stack Overflow
or by Damien Joe
Published on 2011-01-17T06:50:41Z
Indexed on
2011/01/17
6:53 UTC
Read the original article
Hit count: 570
I have table structure like
Category EmpName
1 Harry
1 John
1 Ford
2 James
2 Mark
2 Shane
3 Oliver
3 Ted
I want results like
Category EmpName RowNumber
1 Harry 1
1 John 2
1 Ford 3
2 James 1
2 Mark 2
2 Shane 3
3 Oliver 1
3 Ted 2
I am using db2 and row_number() is not working for different groups of records.
© Stack Overflow or respective owner