开发者

query to ignore first 2 rows

开发者 https://www.devze.com 2023-01-10 07:54 出处:网络
i have a query to fetch 100 rows of events ordered by timestamp. i want to ignore top 2 entries from the result set. The problem is that there is no criteria match (simply to ignore first 2 rows).

i have a query to fetch 100 rows of events ordered by timestamp. i want to ignore top 2 entries from the result set. The problem is that there is no criteria match (simply to ignore first 2 rows).

i am using pager (drupal) which results 10 events per page. If i process开发者_Python百科 it after fetching 10 rows i lost 2 entries (first page contains only 8 entries). how to solve the problem ?


If you are using Views, you can just set the offset to 2 which will ignore the first two records.


USe limit LIMIT 2,98


LIMIT 2,100

Add that to your SQL command, I think it should work.


You can't use offsets with pager_query() which I assume you're using here. Maybe you need to reconsider how you're querying? Maybe run a query for the first two records, and then in your pager SQL use a WHERE condition to exclude the IDs of the first two results.

0

精彩评论

暂无评论...
验证码 换一张
取 消