select sum(1) over() as total, sum(1) over(order by id) as idx from test_table;
假设test_table 结果为:
total | idx |
10 | 1 |
10 | 2 |
10 | 3 |
10 | 4 |
10 | 5 |
10 | 6 |
10 | 7 |
10 | 8 |
10 | 9 |
10 | 10 |
select sum(1) over() as total, sum(1) over(order by id) as idx from test_table;
假设test_table 结果为:
total | idx |
10 | 1 |
10 | 2 |
10 | 3 |
10 | 4 |
10 | 5 |
10 | 6 |
10 | 7 |
10 | 8 |
10 | 9 |
10 | 10 |