----- Original Message ----- > From: "Ananda Kumar" <anan...@gmail.com> > Subject: Re: Re: Retrieve most recent of multiple rows > > select * from tab where anwer_timestamp in (select max(anwer_timestamp) from > tab where q_id in (select distinct q_id from tab) group by q_id);
This is entirely equivalent to select * from tab where anwer_timestamp in (select max(anwer_timestamp) from tab group by q_id); Additionally, there are no double timestamps in the dataset you used, whereas there are in OP's given dataset. It's also fairly hard to provide an accurate solution as long as OP hasn't clarified what exactly they want, really. -- Unhappiness is discouraged and will be corrected with kitten pictures. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql