leave that as an exercise for the student.)
> -Original Message-
> From: Johan De Meersman [mailto:vegiv...@tuxera.be]
> Sent: Thursday, March 14, 2013 8:29 AM
> To: Ananda Kumar
> Cc: MySQL; Stefan Kuhn
> Subject: Re: Retrieve most recent of multiple rows
>
>
2013/03/13 13:18 +, Norah Jones
I have a table which looks like this:
answer_id q_id answer qscore_id answer_timestamp
1 10Male3 1363091016
2 10Male3 1363091017
3 11Male3 1363091018
e: 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_times
- Original Message -
> From: "Ananda Kumar"
> 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
rsh
> Stefan
>
>
> On Wed, Mar 13, 2013 at 8:28 PM, Johan De Meersman >wrote:
>
> > ------
> >
> > *From: *"Ananda Kumar"
> > *Subject: *Re: Retrieve most recent of multiple rows
> >
> >
> >
> > select qid,max(atimestamp) from
13 at 8:28 PM, Johan De Meersman wrote:
> --
>
> *From: *"Ananda Kumar"
> *Subject: *Re: Retrieve most recent of multiple rows
>
>
>
> select qid,max(atimestamp) from kkk where qid in (select distinct qid from
> kkk) group by qid;
>
not all the rows, only the distinct q_id,
On Wed, Mar 13, 2013 at 8:28 PM, Johan De Meersman wrote:
> --
>
> *From: *"Ananda Kumar"
> *Subject: *Re: Retrieve most recent of multiple rows
>
>
>
> select qid,max(atimestamp) from kkk
- Original Message -
> From: "Ananda Kumar"
> Subject: Re: Retrieve most recent of multiple rows
> select qid,max(atimestamp) from kkk where qid in (select distinct qid
> from kkk) group by qid;
What use is that where statement? It just says to use all
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 wrote:
> - Original Message -
> > From: "Norah Jones"
> > Subject: Retrieve most recent of multiple rows
> >
> > 4
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);
On Wed, Mar 13, 2013 at 6:48 PM, Norah Jones wrote:
> I have a table which looks like this:
>
> answer_id q_id answer qscore_id answer_timestamp
ata
>
>
> On Wed, Mar 13, 2013 at 7:19 PM, Johan De Meersman wrote:
>
>> - Original Message -
>> > From: "Norah Jones"
>> > Subject: Retrieve most recent of multiple rows
>> >
>> > 4 10Male3 1363091019
- Original Message -
> From: "Norah Jones"
> Subject: Retrieve most recent of multiple rows
>
> 4 10Male3 1363091019
> 5 11Male3 1363091020
> 6 12Male3 1363091020
>
12 matches
Mail list logo