I have a table “test”. the stamp gets updated everytime table is updated.
id | text | stamp
__________________________
1 | textA | 2012-11-06 01:06:34
2 | textB | 2012-11-06 01:01:34
3 | textC | 2012-11-06 01:03:34
4 | textD | 2012-11-06 01:05:34
5 | textE | 2012-11-06 01:02:34
6 | textF | 2012-11-06 01:08:34
7 | textG | 2012-11-06 01:09:34
8 | textH | 2012-11-06 01:04:34
I run a query
“SELECT * from test ORDER BY stamp DESC LIMIT 3” (This returns rows with id 7,6 and 1)
Now I have the id of the last row returned (ie 1). How do I use that id to run a second query to fetch next 3 rows where the time stamp < stamp of id ?
Expected result is rows 4,8,3.
1 Answer