Or if there might be multiple records tied for max hits: max_select = db(db.videos)._select(db.videos.hits.max()) records = db(db.videos.hits.belongs(max_select)).select()
Anthony On Monday, March 26, 2012 12:20:31 PM UTC-4, rochacbruno wrote: > > record = db(db.videos).select(orderby=~db.videos.hits).first() > > > On Mon, Mar 26, 2012 at 1:11 PM, Hassan Alnatour < > halna...@gardeniatelco.com> wrote: > >> Dear ALL , >> >> I have a Table like this : >> >> db.define_table('Videos', >> Field('Title'), >> Field('File','upload'), >> Field('Hits','integer')) >> >> >> how can i get the record with the highest Hits ? >> > > > > -- > > Bruno Rocha > [http://rochacbruno.com.br] > >