oracle查询怎么查询某条数据在第几行

更新时间:02-09 教程 由 忆离人 分享

oracle查询怎么查询某条数据在第几行?

select t.*,rownum rn from table1 t --rownum就是记录所在的行数你是指定ID去查询,得到的记录只有一条,所以rownum始终是1了,你想要的结果应该是select tt.*,tt.rn from (select t.*,row_number() over (order by id) rn from table1 t ) tt where tt.id = 你要查询的ID值

声明:关于《oracle查询怎么查询某条数据在第几行》以上内容仅供参考,若您的权利被侵害,请联系13825271@qq.com
本文网址:http://www.25820.com/tutorial/14_2183201.html