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
- Original Message -
From: Ananda Kumar
: 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
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
4
not all the rows, only the distinct q_id,
On Wed, Mar 13, 2013 at 8:28 PM, Johan De Meersman vegiv...@tuxera.bewrote:
--
*From: *Ananda Kumar anan...@gmail.com
*Subject: *Re: Retrieve most recent of multiple rows
select qid,max(atimestamp) from kkk where qid
De Meersman vegiv...@tuxera.bewrote:
--
*From: *Ananda Kumar anan...@gmail.com
*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
:
--
*From: *Ananda Kumar anan...@gmail.com
*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 the rows in the
table
- 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
- Original Message -
From: Norah Jones nh.jone...@gmail.com
Subject: Retrieve most recent of multiple rows
4 10Male3 1363091019
5 11Male3 1363091020
6 12Male3 1363091020
7 11
this is the data i tested on
AIDQID ANS SCRID ATIMESTAMP
-- -- -- --
---
1 10 male3 13-MAR-13 02.03.20.00 PM
2 10
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 nh.jone...@gmail.com wrote:
I have a table which looks like this:
answer_id q_id answer qscore_id
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 vegiv...@tuxera.bewrote:
- Original Message -
From: Norah Jones nh.jone...@gmail.com
Subject: Retrieve most recent of multiple rows
4 10
- Original Message -
From: Ananda Kumar anan...@gmail.com
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 the rows in the
table
12 matches
Mail list logo