so i have a record set:

id user text
1  2  ...
2  6  ...
3  2  ...
4  4  ...
5  2  ...
6  8  ...
7  1  ...
8  8  ...
9  2  ...


so lets say I am looking at record 3. i need to know the previous record in
the table that has that user, as well as the next record in the table that
has that user.

right now i am using 2 queries.

select text from table where user = 2 and id < 3 order by id ASC limit 1;
select text from table where user = 2 and id > 3 order by id ASC limit 1;

is it possible to do this using 1 query?

Reply via email to