Counter [message #268622] |
Wed, 19 September 2007 03:21 |
dimis283
Messages: 38 Registered: July 2007 Location: greece
|
Member |
|
|
I have a repeating frame, for example
name surname
dimis Miles
pavlos Kramnik
and I want to add a field that gives the count of each line
as
count name surname
1 dimis Miles
2 pavlos Kramnik
3 nikos karpow
How I can do it?
Dimis
|
|
|
|
|
Re: Counter [message #268794 is a reply to message #268628] |
Wed, 19 September 2007 14:04 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Oh, yet another possibility:SQL> WITH test AS
2 (SELECT 'dimis' name FROM dual
3 UNION
4 SELECT 'pavlos' name FROM dual
5 UNION
6 SELECT 'nikos' name FROM dual
7 )
8 SELECT row_number() over (ORDER BY name) rn, name
9 FROM test;
RN NAME
---------- ------
1 dimis
2 nikos
3 pavlos
|
|
|