SQL 取表中第幾行至第幾行數據


第一種:

1 select top 6 * from
2 (
3 select top 14 * from stu order by id
4 ) as t
5 order by id desc

第二種(推薦):

1 with total as
2 (
3     select *,row_number() over(order by name) as rownum from stu
4 )
5 select * from total where rownum between 10 and 15

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM