MySQL社区

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
查看: 1895|回复: 1
打印 上一主题 下一主题

[SQL类] MYSQL 排名

[复制链接]
1#
发表于 2013-7-14 12:35:37 | 显示全部楼层
if your table is named test1 ,then
update test1 x
inner join ( SELECT
a.id,count(*) as rank from  test1   a
inner join  test1 b on a.score<=b.score
group by  a.id) y
on x.id =y.id
set x.rank =y.rank
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|申请友链|小黑屋|Archiver|手机版|MySQL社区 ( 京ICP备07012489号   
联系人:周生; 联系电话:13911732319

GMT+8, 2024-5-23 04:59 , Processed in 0.063937 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表