当前位置:网站首页>mysql中的数据结果排名
mysql中的数据结果排名
2022-07-25 09:12:00 【你怎么不笑了】
比如:查询到用户的积分,薪水数据后,附带一个排名的属性值
如需其他查询条件添加上即可,比如同分就可以按时间先后顺序
SELECT
a.*,
@rank := @rank + 1 AS rankNo
FROM
(
SELECT
userinfo_id AS userid,
userinfo_name AS nickname,
SUM( score ) AS score
FROM
my_point
GROUP BY
userinfo_id
ORDER BY
score DESC
) a,
( SELECT @rank := 0 ) b
运行后,会得到如下的结果,按积分降序并且有对应的排名名次
后面补充。。
边栏推荐
- Full solution of JDBC API
- Additional: in the lower division / county (data sheet)
- SQL injection
- This ten-year content industry infrastructure company is actually an invisible Web3 pioneer
- Intel apologized to the winners of Xe HPG treasure hunt game for product delay and announced the appearance of the prize
- BGP border gateway protocol basic knowledge points
- Visual query (sp_helptext) -- quick query of stored procedures containing specified strings (with source code)
- Django4.0 + Web + MySQL5.7 实现简单登录操作
- Solutions to ten questions of leetcode database
- Oracle10g单实例数据库升级到哪个版本好,求建议
猜你喜欢

BGP border gateway protocol basic knowledge points

音乐人的 NFT 指南

Redis/Mysql知识概述

51 single chip microcomputer controls nixie tube display

Redis学习笔记

PL/SQL工具导出sql文件所使用的命令是什么?

YOLOV5环境配置
![[Development Tutorial 9] crazy shell · open source Bluetooth smart health watch - storage](/img/25/212712d919540763a6c339e1b5a50b.png)
[Development Tutorial 9] crazy shell · open source Bluetooth smart health watch - storage

The simplest sklearn environment configuration tutorial in the whole network (100% success)

51 MCU internal peripherals: serial port communication
随机推荐
图解LeetCode——919. 完全二叉树插入器(难度:中等)
The operation cannot be completed because a folder or file in it is already open in another program
js触屏小游戏源码冰雪之旅
Collection of common algorithm questions in test post interview
Cool canvas animation shock wave JS special effect
Why use MQ message oriented middleware? These questions must be taken down!
YOLOV5环境配置
table表格展开内部行切换效果
Disable module (attribute node) in LabVIEW
The simplest sklearn environment configuration tutorial in the whole network (100% success)
对称式加密与非对称式加密的对比
Rich text style word image processing
Solve NPM error: cannot find module 'shelljs‘
Django4.0 + Web + MySQL5.7 实现简单登录操作
Wechat reservation applet graduation design of applet completion works (3) background function
[deep learning] mask Dino Trilogy - the correct way to open Detr Pandora's box
How to avoid duplicate data when the database is high and distributed
Django4.0 + web + MySQL 5.7 realize simple login operation
51 MCU peripherals: buzzer
2022-7-14 JMeter simulates the login of different users for pressure test