--//创建一个信息表
CREATE TABLE user_student(id decimal(18,0) identity(1,1),st_name nvarchar(30),class nvarchar(10),score decimal(18,2))
--//插入测试数据============start===================
insert into user_student(st_name,class,score)
values('张三','甲','') insert into user_student(st_name,class,score)
values('张四','甲','') insert into user_student(st_name,class,score)
values('张五','甲','') insert into user_student(st_name,class,score)
values('李三','乙','') insert into user_student(st_name,class,score)
values('李四','乙','') insert into user_student(st_name,class,score)
values('李五','乙','') insert into user_student(st_name,class,score)
values('王三','丙','') insert into user_student(st_name,class,score)
values('王四','丙','') insert into user_student(st_name,class,score)
values('王五','丙','')
--//插入测试数据============end===================
select * from user_student --//每个班级分数前两名的学生信息
SELECT ST_NAME,CLASS,SCORE
FROM (
SELECT Row_number() OVER(PARTITION BY CLASS ORDER BY SCORE DESC) AS NUM,*
FROM user_student
) AS T
WHERE NUM<=2

表内数据:aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOcAAAD0CAIAAADv1KZCAAAUl0lEQVR4nO2dS4/cRpLH8+vsodVSUzroIllPSx9gT35IY8u05W8iQFcJ4K0Pgi6LufQe9tpnNYHFDGamB2P0zNiyPbstDdStl9v9AOfAFofFjMiMJJnByGL8QRRYLDL5Z+avglFFBmgu3P72wu1v91SqdGSUWlVyMhduf/sfF/9zahsqVYA01qrS0ym1Dx4+SnSaugNVE+jf1FYJSqmdp07z2nSplT9NPcRLqORj7bFsKbUx5Kc2L0pwyvLuxMlrrQcPH71e1Obm5ubm5sai1tefvJ5CSm0kkagtyup0KqocmdzUGmMcb0ektii6NnZ3d/OiUGqXSf68lhJls7zMskHUGlxuavcX1VC7v79fvqzKl9XTZ3t5XuxPoaOjI6U2hvyxth29tra2mvnNzc165uDgoCjKLMu9yDqgbNOJzYPUdo6ndru9vV2W5dbW1tNne0VR5nkxqI+M6fHR3t6eUhtJYdQ2pFZVtbGxUSNbR7iLFy96kXWw2DvWvlpUUZRFWW5sbBRFub7+pJ7yvHhFljGGMoOp3ZRSG0l+atfXn2xvb29t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oajiYo5aQ0O8/4/OKqpwaDWI3NOgVN5oM4cj3DQD7cGhyBzroHTeGhxlvTHHI9w0A+3Bocacx6AU3mgHueM+ZwqzrnAbpuzlThNJYHs07UCZk6Tz/VeDyGeVaUnWQ1bnpnzaSNI5sz5XN/MaaYGs1z/0jYiy1yJy+dEP5i18B5qW7bK50KpwcHEwm5FmTmf6j6fC6IGp6QU50r1B8CnB2/qPp+LNTgqUXAbige7fC7WQ6hEwW0oHuzyucicShTchuLBLp+LNTgqUXAbiocqc7ehDUcT6MQaHLwouA3FQ425QTrm5EnzuagovTBcvmHurfdvD0eTt96/DU3M56yZj4qSqcYctEE6hk5kLsqFJMzxaBeZi3KhCnPv3R6k47feuw1NzOf6Mxm1U6oxNxxNOHMxn4typP8BxBXZEjYzBVAAAAAASUVORK5CYII=" alt="" />

Row_number() OVER(PARTITION BY xxx ORDER BY XXX)分组排序的更多相关文章

  1. row_number()over(partition by 字段 order by 字段)ID,修改重复行的字段值。

    案例分析: 现在要查询一个表单里面的运费结果,但是他还有分录,为了显示分录,必须把表头显示出来,问题是,他要查询运费的合计, 但是这样就会导致重复行也加进去了,这样显然数据不准,为此,可以把重复的行设 ...

  2. SQL技术内幕-4 row_number() over( partition by XX order by XX)的用法(区别于group by 和order by)

    partition by关键字是分析性函数的一部分,它和聚合函数不同的地方在于它能返回一个分组中的多条记录,而聚合函数一般只有一条反映统计值的记录,partition by用于给结果集分组,如果没有指 ...

  3. row_number() OVER (PARTITION BY COL1 ORDER BY COL2)

    select *,ROW_NUMBER() over(partition by deviceID order by RecordDate desc row_number() OVER (PARTITI ...

  4. select p.id, name,ROW_NUMBER() over(PARTITION by name order by p.id) names from person p

    select p.id, name,ROW_NUMBER() over(PARTITION  by name order by p.id) names from person p

  5. row_number() over (partition by....order by...)用法 分组排序

    row_number() over (partition by....order by...)用法 分组排序 row_number() OVER (PARTITION BY COL1 ORDER BY ...

  6. ROW_NUMBER() OVER(PARTITION BY COLUMN ORDER BY COLUMN)

    背景 老生常谈,为sql当时着迷了,啥都用sql解决.看这个语句,麻烦的. ROW_NUMBER() OVER(PARTITION BY COLUMN ORDER BY COLUMN) 简单的说row ...

  7. ROW_NUMBER() OVER(PARTITION BY COLUMN ORDER BY COLUMN DESC)函数的使用

    ROW_NUMBER() OVER(PARTITION BY COLUMN ORDER BY COLUMN DESC)函数的作用是指定COLUMN(列)进行分区,在分区内指定COLUMN(列)进行排序 ...

  8. rownum与row_number() OVER (PARTITION BY COL1 ORDER BY COL2)

    1)rownum 为查询结果排序.使用rownum进行排序的时候是先对结果集加入伪列rownum然后再进行排序 select rownum n, a.* from ps_user a order by ...

  9. oracle ROW_NUMBER() OVER (PARTITION BY COL1 ORDER BY COL2)

    工作中遇到的一个问题,需要对某列进行分组排序,取其中排序的第一条数据项 用到了ROW_NUMBER() OVER(PARTITION BY COL1 ORDER BY COL2)来解决此问题. 实例准 ...

随机推荐

  1. spring 配置 junit

    package cn.hefen.mall.app; import cn.hefen.mall.app.model.ResultMap; import cn.hefen.mall.app.model. ...

  2. 使用sqlmetal工具自动生成SQL数据库的Linq类文件

    第一部:找到sqlmetal.exe. 运行cmd. 执行命令 cd C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5 ...

  3. hdu6223 Infinite Fraction Path 2017沈阳区域赛G题 bfs加剪枝(好题)

    题目传送门 题目大意:给出n座城市,每个城市都有一个0到9的val,城市的编号是从0到n-1,从i位置出发,只能走到(i*i+1)%n这个位置,从任意起点开始,每走一步都会得到一个数字,走n-1步,会 ...

  4. HDU 4352 区间的有多少个数字满足数字的每一位上的数组成的最长递增子序列为K(数位DP+LIS)

    题目:区间的有多少个数字满足数字的每一位上的数组成的最长递增子序列为K 思路:用dp[i][state][j]表示到第i位状态为state,最长上升序列的长度为k的方案数.那么只要模拟nlogn写法的 ...

  5. ConvertLongToInstantUtil

    package com.test; import java.time.Instant; import java.time.OffsetDateTime; import java.time.ZoneId ...

  6. python -- Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    用python读取hive数据,引用下面包. #!/usr/bin/env python import pyhs2 as hive 先按照它 pip install pyhs2 出现错误 Collec ...

  7. linux 6 安装 使用 XtraBackup

    帮助文档:https://www.cnblogs.com/imweihao/p/7290026.html ---Yum安装 官网地址:https://www.percona.com/doc/perco ...

  8. 网页console console.log 用法 Chrome F12

    #########sample 0 https://www.cnblogs.com/xiaozong/p/4961929.html https://blog.csdn.net/shanliangliu ...

  9. vue proxyTable 接口跨域请求调试(五)

    在不同域之间访问是比较常见,在本地调试访问远程服务器....这就是有域问题. VUE解决通过proxyTable: 在 config/index.js 配置文件中 dev: { env: requir ...

  10. 还是畅通工程(prim和kruskal)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1233 还是畅通工程 Time Limit: 4000/2000 MS (Java/Others)    ...