Home > Database > Mysql Tutorial > body text

关于sql row_number,rank,dense_rank,ntile函数

WBOY
Release: 2016-06-07 17:39:17
Original
1211 people have browsed it

row_number排序最好用它,它依次排名,不出现相同名次,如:1,2,3,4,5 rank出现相同排名,且跳过相同的排名号排下一名,如:1,1,3,4,5, dense_rank出现相同排名,不跳过相同排名号,如:1,1,2,3,4, ntitle()按值分成多少组的排序,如:ntitel(3

row_number排序最好用它,它依次排名,不出现相同名次,如:1,2,3,4,5

rank出现相同排名,且跳过相同的排名号排下一名,,如:1,1,3,4,5,

dense_rank出现相同排名,不跳过相同排名号,如:1,1,2,3,4,

ntitle()按值分成多少组的排序,如:ntitel(3),1,1,2,2,3分组依据:1,每组的记录数不能大于它上一组的记录数。
2,所有组中的记录要么都相同,要么从某组开始后面所有组的记录数都与该组的记录数相同。

都与over orderby 配合使用

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template