排序的是数字型栏位,用一条sql得到某条记录排在第几,
如这条记录:
select id from table where id=300 order by id asc按照order by id asc排序,如何得到id=300这条记录目前是第几条记录?不会是第300条的,因为中间可能有删除。
如这条记录:
select id from table where id=300 order by id asc按照order by id asc排序,如何得到id=300这条记录目前是第几条记录?不会是第300条的,因为中间可能有删除。
解决方案 »
- 拉下选项,html select的问题...
- 怎样利用PHP处理WEB前台信息
- 對象序列化
- 初学问个关于function的小问题,比较弱智,但很迷惑,请指点一下。
- PHP 中imagecopyresized函数把图像的颜色转变了,这是怎么回事?
- 模糊匹配!!!!!!
- 如何把select的信息进行提交到数据库
- php ajax 时候出现 Uncaught TypeError: Cannot read property 'cellphone' of undefined
- 高分求一个上传文件的php代码!谢谢!!!
- 初识php:如何判断php服务是否启动?
- 用php实现图片翻转
- 如何用正则在字符串插入分割符?
select count(A.id) as getTotal from table A left join table B on A.id<B.id where B.id=300
select @i:=(@i+1) as bh, id from table order by id HAVING id=300