views:

57

answers:

4

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 it after fetching 10 rows i lost 2 entries (first page contains only 8 entries). how to solve the problem ?

+2  A: 

USe limit LIMIT 2,98

Mchl
you can't use limit with pager query
Paniyar
That must be drupal specific limitation I think. Added a drupal tag.
Mchl
Or perhaps you can use subqueries?
Mchl
thank you for your edit and answer Mchl
Paniyar
[`pager_query()`](http://api.drupal.org/api/function/pager_query/6) executes its own query, and doesn't accept any parameters that allow to refine it, or to expand it as requested by the OP.
kiamlaluno
+1  A: 
LIMIT 2,100

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

ILMV
As reported in other comments it's not possible to limit the query executed by `pager_query()`, as the function doesn't accept any parameter to refine the query it runs.
kiamlaluno
+4  A: 

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

Kevin
+2  A: 

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.

Dave Reid