惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
F
Full Disclosure
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Engineering at Meta
Engineering at Meta
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Threatpost
I
Intezer
V2EX - 技术
V2EX - 技术
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
小众软件
小众软件
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
N
News | PayPal Newsroom
MyScale Blog
MyScale Blog
AI
AI
Vercel News
Vercel News
Spread Privacy
Spread Privacy
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
Help Net Security
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
L
LINUX DO - 热门话题
U
Unit 42
L
LangChain Blog
Recent Announcements
Recent Announcements

博客园 - senly

金财微报表的技术支持服务 党建积分的技术支持服务 IE6的position:fixed PHP实现前台同步显示后台任务进度 css秘籍:复选框与文字对齐的问题 php遍历数组 list foreach each方法总结 jQuery cookie 购物车及其实现 CSS自定义滚动条样式 php根据ip查询所在地区(非常有用,赶集网就用到) iframe 父窗口和子窗口相互的调用方法集锦 44种IE css bug实例测试总结 IE6不支持position:fixed的解决方法 jQuery精仿手机上的翻牌效果菜单 jquery菜单左右翻屏效果 jQuery实现无限循环滚动公告 Load JSON data with jQuery, PHP and MySQL php把从数据库读取出来的数据存放到数组里 DedeCMS会员排行调用代码,实现连接到会员空间 程序员们 不要想一辈子靠技术混饭吃
mysql 实现行号的方法——如何获取当前记录所在行号
senly · 2011-12-16 · via 博客园 - senly

MYSQL目前不支持行号功能,如果想按某字段进行排序,然后得到排序号,很麻烦,要想实现这种功能,网上的答案五花八门,经过几次实验,得出如下一条SQL文就能简单实现此功能,现共享一下。

表 a:

UID Money
2 444
1 222
3 555
4 6666

想要以Money排序取得排行号:SQL文如下:

Select UID,(@rowNum:=@rowNum+1) as rowNo

From a,
(Select (@rowNum :=0) ) b
Order by a.Money Desc

输入结果如下:

UID rowNo
4 1
3 2
2 3
1 4