天天看點

MySQL實作分頁,SQLServer實作分頁

MySQL實作分頁

select * from 表名 where id>90 order by id limit 10

十條一頁,查詢第91-100條資料,其中數字用變量代替

limit靈活運用可有多種實作方式

推薦使用

select * from table a, (select id from table where... limit 10,10) t where a.id = t.id

SQLServer實作分頁

select top 10 * from 表 where id not in (select top 90 id from 表 order by id) order by id

十條一頁,查詢第91-100條資料,其中數字用變量代替

top靈活運用可有多種實作方式