Home > Database > Mysql Tutorial > body text

【ROW_NUMBER 函数(Transact-SQL)】

WBOY
Release: 2016-06-07 17:37:42
Original
1134 people have browsed it

【ROW_NUMBER 函数(Transact-SQL)】返回结果集分区内行的序列号,每个分区的第一行从 1 开始。 注释: ROW_NUMBER() OVER (PARTITION BY COL1 ORDER BY COL2) --(其中,COL1,COL2可以为多列) select xt.id,xt.item,xt.attribute1,xt.attribute2,ROW_NUMBER(

【ROW_NUMBER 函数(Transact-SQL)】返回结果集分区内行的序列号,每个分区的第一行从 1 开始。

注释: ROW_NUMBER() OVER (PARTITION BY COL1 ORDER BY COL2) --(其中,COL1,,COL2可以为多列)

select xt.id, xt.item, xt.attribute1, xt.attribute2, ROW_NUMBER() OVER(PARTITION BY xt.id,xt.item order by xt.id,xt.item) test from xxuts_test xt

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