SQL> with test (product, value) as
2 (select 'A', 100 from dual union all
3 select 'B', 100 from dual union all
4 select 'C', 100 from dual union all
5 select 'A', 100 from dual union all
6 select 'B', 100 from dual union all
7 select 'A', 100 from dual union all
8 select 'D', 100 from dual union all
9 select 'D', 100 from dual union all
10 select 'F', 100 from dual union all
11 select 'F', 100 from dual union all
12 select 'F', 100 from dual
13 )
质询:
14 select product, value,
15 row_number() over (partition by product order by null) classification
16 from test
17 order by product;
PRODUCT VALUE CLASSIFICATION
---------- ---------- --------------
A 100 1
A 100 2
A 100 3
B 100 1
B 100 2
C 100 1
D 100 1
D 100 2
F 100 1
F 100 2
F 100 3
11 rows selected.
SQL>
1条答案
按热度按时间o4tp2gmn1#
看起来像解析函数之一,例如
row_number
(或者rank
)。样本数据:
质询: