數據庫獲取前N條記錄SQL Server與SQLite的區別


在使用sql語句進行前20條記錄查詢時SQL Server可以這樣寫:

1: select top 20 * from [table] order by ids desc

2: select top 20 * from [table] where id not in (select top 20 id from [table] ) 

3: select top 20 * from (select top 30 * from [table] order by id) as tb1 order by tb1.id

而在SQLite中要這樣用:

1:select * from [table] order by id  limit 20

 


免責聲明!

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



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