row_number
row_number 介绍
row_number()
- 根据窗口分区内行的排序,为每一行分配一个唯一的、连续的数字,从一开始。
Examples:
> SELECT a, b, row_number() OVER (PARTITION BY a ORDER BY b) FROM VALUES ('A1', 2), ('A1', 1), ('A2', 3), ('A1', 1) tab(a, b);
A1 1 1
A1 1 2
A1 2 3
A2 3 1
Since: 2.0.0