how do i select a row before a row?
| SitePoint Sponsor |
how do i select a row before a row?





Untested but I can't see why it wouldn't workCode:SELECT fields FROM table WHERE uniqueid=((SELECT uniqueid FROM table WHERE uniqueid=x) - 1)![]()


Mist, it wouldn't work before mysql 4.1 since it uses a subquery
plus, what if there's a gap in id numbers?
try this:Code:select id, foo, bar, qux from yourtable where id < $id order by id desc limit 1





Hehe good point ^^.
thank you very very much. you helped a LOT!
Bookmarks