SQLite Forum

Easy way to scroll through table
Login
Finding the first row:

```
    select * from things
        order by date, rowid
        limit 1;
```

Finding the last row:

```
    select * from things
        order by date desc, rowid desc
        limit 1;
```

Finding the next row with the current date and rowid as bound parameters:

```
    select * from things
        where (date, rowid) > (?1, ?2)
        order by date, rowid
        limit 1;
```

Finding the previous row with the current date and rowid as bound parameters:

```
    select * from things
        where (date, rowid) < (?1, ?2)
        order by date desc, rowid desc
        limit 1;
```

This is for working with one row at a time. For a whole page at a time, raise the limit as appropriate.