MySQL SQL数据排名查询某条数据是总数据的第几条
程序员文章站
2022-06-26 10:30:28
查询所有数据排名
SELECT a.yhid,a.zjf,a.dqjf,(@rowno:=@rowno+1) as rowno
FROM jfxt_yhjfxx a,(s...
查询所有数据排名
SELECT a.yhid,a.zjf,a.dqjf,(@rowno:=@rowno+1) as rowno FROM jfxt_yhjfxx a,(select (@rowno:=0)) b ORDER BY a.zjf DESC
指定查询某条数据的排名
SELECT * FROM ( SELECT a.yhid,a.zjf,a.dqjf,(@rowno:=@rowno+1) as rowno FROM jfxt_yhjfxx a,(select (@rowno:=0)) b ORDER BY a.zjf DESC) c WHERE c.yhid='f531aded-bd09-4574-8826-4482bd918f91'
上一篇: Oracle三层权限体系详细介绍
下一篇: Android编程开发之沉浸式