List:General Discussion« Previous MessageNext Message »
From:Ananda Kumar Date:March 13 2013 2:05pm
Subject:Re: Retrieve most recent of multiple rows
View as plain text  
this is the data i tested on
       AID        QID ANS             SCRID ATIMESTAMP
---------- ---------- ---------- ----------
---------------------------------------------------------------------------
         1         10 male                3 13-MAR-13 02.03.20.000000 PM
         2         10 male                3 13-MAR-13 02.03.28.000000 PM
         3         11 male                3 13-MAR-13 02.03.33.000000 PM
         4         10 male                3 13-MAR-13 02.03.36.000000 PM
         5         11 male                3 13-MAR-13 02.03.41.000000 PM
         6         12 male                3 13-MAR-13 02.03.48.000000 PM
         6         11 male                3 13-MAR-13 02.04.04.000000 PM

7 rows selected.

select qid,max(atimestamp) from kkk where qid in (select distinct qid from
kkk) group by qid;

       QID MAX(ATIMESTAMP)
----------
---------------------------------------------------------------------------
        11 13-MAR-13 02.04.04.000000 PM
        10 13-MAR-13 02.03.36.000000 PM
        12 13-MAR-13 02.03.48.000000 PM




On Wed, Mar 13, 2013 at 7:28 PM, Ananda Kumar <anandkl@stripped> wrote:

> can you please share the sql that you executed to fetch the above data
>
>
> On Wed, Mar 13, 2013 at 7:19 PM, Johan De Meersman <vegivamp@stripped>wrote:
>
>> ----- Original Message -----
>> > From: "Norah Jones" <nh.jones01@stripped>
>> > Subject: Retrieve most recent of multiple rows
>> >
>> >     4          10    Male    3          1363091019
>> >     5          11    Male    3          1363091020
>> >     6          12    Male    3          1363091020
>> >     7          11    Male    3          1363091025
>> >
>> >
>> >     4          10    Male    3          1363091019
>> >     6          12    Male    3          1363091020
>> >     7          11    Male    3          1363091020
>>
>> The data in your result does not match the data in your source. Please
>> clarify :-)
>>
>>
>> --
>> 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
>>
>>
>

Thread
Retrieve most recent of multiple rowsNorah Jones13 Mar
  • Re: Retrieve most recent of multiple rowsAnanda Kumar13 Mar
  • Re: Retrieve most recent of multiple rowsJohan De Meersman13 Mar
    • Re: Retrieve most recent of multiple rowsAnanda Kumar13 Mar
      • Re: Retrieve most recent of multiple rowsAnanda Kumar13 Mar
        • Re: Retrieve most recent of multiple rowsJohan De Meersman13 Mar
          • Re: Retrieve most recent of multiple rowsAnanda Kumar14 Mar
  • Re: Retrieve most recent of multiple rowshsv16 Mar