so group by fieldname2 and retrieve max(time). if you want the id too which can't be included in the group you'd better use a raw sql statement.
On Tuesday, May 10, 2016 at 1:56:24 AM UTC+2, PRACHI VAKHARIA wrote: > > > > > Please *Refer to the Attached Image for the Table and DataSet types*. > > The output should be: > > *The latest rows corresponding to each FieldName2 value.Latest means > Max(Time) for that particular FieldName2 value.* > Output must be (Ref attached image): > > *1005* > > *0020* > > F1_Values_0006 > > FN2_Value_1 > > *1011* > > *0032* > > F1_Values_0012 > > FN2_Value_2 > > *1018* > > *0046* > > F1_Values_0019 > > FN2_Value_3 > > > These are the latest rows corresponding to each FieldName2 values: > FN2_Value_1, FN2_Value_2, FN2_Value_3 > For the latest Times corresponding to each of the FieldName2 values. > > > How to write DAL Query to fetch these? > > > > Thank you, very much! > > > > > *— PRACHI —* > > On Monday, 9 May 2016 05:28:53 UTC-4, Niphlod wrote: >> >> in addition to groupby you need to select the aggregate you want. >> "the latest row for fieldname2" is really the max(some_other_column) for >> each group. >> That being said, please show your data and your desired resultset: I'm >> guessing it'll be a little harder to retrieve what you want. >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.