On Thu, Mar 6, 2008 at 9:54 PM, J. Hill <jh@xxxxxxxxxxx> wrote: > I may be a little confused: the desire is to return all the rows from > TableA that match the record_id of a row in TableB that has the MAX > timestamp? > > If so, why not something like: > > SELECT * FROM TableA a, TableB b WHERE a.record_id=b.record_id && > timestamp=(SELECT MAX(timestamp) FROM TableB) ORDER BY action; > > I'm guessing I'm confused, that it's something more complicated you're > looking for. > Thanks Krister and all for your help thus far. Jeff, I'm after all rows from TableA then the latest action from TableB for each selected record in TableA. I'm starting to think maybe I should build an array of results using 2 queries then sort the array using PHP functionality, but I'd rather do it in MySQL if it's possible. Graham -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php