|
Re: Need a unique Serial on basis of matching records values [message #632965 is a reply to message #632963] |
Mon, 09 February 2015 03:46 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
As it is a non-database form, where do you get those values from?
What you described reminds me of RANK (or DENSE_RANK) analytic functions. Here's an example:
SQL> with test as
2 (select 'A' let, 'Roma' nam from dual union all
3 select 'A', 'Los Angeles' from dual union all
4 select 'B', 'New york' from dual union all
5 select 'C', 'Rio' from dual union all
6 select 'C', 'London' from dual union all
7 select 'C', 'Budapest' from dual
8 )
9 select
10 let,
11 nam,
12 rank() over (order by let) rnk,
13 dense_rank() over (order by let) drnk
14 from test
15 order by let, nam;
L NAM RNK DRNK
- ----------- ---------- ----------
A Los Angeles 1 1
A Roma 1 1
B New york 3 2
C Budapest 4 3
C London 4 3
C Rio 4 3
6 rows selected.
SQL>
Would it do any good?
|
|
|
|
|
|
|