0

I am using sqlite3 database in my project. for that I can retrive the data from the Database using following query "select * from tablename"..

But I want to take the hundred sequence records from the database, like If I scroll the UITableView based on the I want to take 100 100 records.

I have tried the following things, SELECT * FROM mytable ORDER BY record_date DESC LIMIT 100; - It retrives only 100 records.When I scroll the table i want to fetch the next 100 records and show it.

Is it possible to do it

Please Guide me.

4

1 回答 1

1

您可以简单地使用该OFFSET子句,但这仍然会强制数据库计算您跳过的所有记录,因此对于较大的表来说效率会很低。

您应该做的是保存record_date上一页的最后一个值,并继续以下内容:

SELECT *
FROM MyTable
WHERE record_date < ?
ORDER BY record_date DESC
LIMIT 100

有关详细信息,请参阅https://www.sqlite.org/cvstrac/wiki?p=ScrollingCursor

于 2013-07-10T06:49:54.697 回答