Daft SQL question. I have a table like so (\'pid\' is auto-increment primary col)
CREATE TABLE theTable ( `pid` INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
select * from ( select `pid`, `timestamp`, `cost`, `rid` from theTable order by `timestamp` desc ) as mynewtable group by mynewtable.`rid` order by mynewtable.`timestamp`
Hope I helped !