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 <anan...@gmail.com> 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 <vegiv...@tuxera.be>wrote: > >> ----- Original Message ----- >> > From: "Norah Jones" <nh.jone...@gmail.com> >> > 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 >> >> >