SQL server implements the basic paging function, and SQL SERVER implements Paging
SQL SERVER implements basic paging functions using NOT IN and SELECT TOP for paging
Use WH_WorkshopInforSys -- create a temporary table select IDENTITY (int, 1, 1) as id, * into mytablefrom dbo. pnlBaobiao -- select top 10 * from mytablewhere id not in (select top 40 id from mytable order by id) order by id -- delete table drop table mytable
Since the original table does not have a sequence number for the table, we need to create a temporary table to store the table with the auto-increment sequence number, and then perform paging operations on the table, the temporary table can be deleted at the end, so the efficiency may be relatively low. This is the clearest way of thinking, and the query speed is acceptable for tables with IDs.
, Table starting from 41
How to achieve efficient jsp paging display (the database is sqlserver), it is best to have an instance;
Use SQL paging.
Select top 10 from tablename where id not in (select top 10 id from tablename)
Generally, all data in the database is retrieved at one time on the page.
Mssql can use the top keyword to query only the displayed content.
Paging statement using sqlserver
Here is a reference
String SQL = "select top 5 * from bean where id not in (select top" + 5 * (pageNum-1) + "id from bean order by id )";