List:General Discussion« Previous MessageNext Message »
From:Johan De Meersman Date:March 14 2013 3:28pm
Subject:Re: Retrieve most recent of multiple rows
View as plain text  
----- Original Message -----
> From: "Ananda Kumar" <anandkl@stripped>
> 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.
Thread
Aw: Re: Retrieve most recent of multiple rowsStefan Kuhn14 Mar
  • Re: Re: Retrieve most recent of multiple rowsAnanda Kumar14 Mar
    • Re: Retrieve most recent of multiple rowsJohan De Meersman14 Mar
      • Re: Retrieve most recent of multiple rowsMarcus Vinicius15 Mar
      • RE: Retrieve most recent of multiple rowsRick James18 Mar