如何从数据库中获取第5条记录 [英] how to fetch 5th record from dataase
本文介绍了如何从数据库中获取第5条记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从数据库中获取第5条记录,无论是否使用top ...如何编写查询
i want to fetch only 5th record from database with or without using top.. how to write a query
推荐答案
听起来像是面试问题。你有没有用Google搜索过它?
在Google上查看几个解决方案 HERE 。
Sounds like an interview question. Have you ever Googled it?
Have a look at several solutions on Google for this HERE.
试试这个:
try this:
WITH table2 AS (SELECT (ROW_NUMBER() OVER (ORDER BY table1.someField ASC)) as rownum,* FROM table1)
SELECT * FROM table2 WHERE rownum=5
这篇关于如何从数据库中获取第5条记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文