In MSSQL, I just order by NEWID()... On Friday, July 19, 2013 11:35:45 AM UTC-7, Massimo Di Pierro wrote: > > Sorry. I do not fully understand the question. > > > rows = db(db.a.status==False).select(db.a.md5,orderby='<random>',limitby=(0, > 150)) > > *is the same as* > > * for row in db(db.s.status==False).select(db.s.md5): > md5_list.append(row['md5']) > random.shuffle(md5_list) > md5_list=md5_list[:150]* > > > The former as you say is more efficient. Does it not work for you? Which > database? > > On Friday, 19 July 2013 13:20:45 UTC-5, Nam Soo In wrote: >> >> I want to write select statement with random and limited number >> It looks like that. >> >> db(db.a.status==False).select(db.a.md5,orderby='<random>',limitby=(0, 149)) >> >> what it dose is it dose random on result and take 150 rows >> >> >> if you write it in python >> >> * for row in db(db.s.status==False).select(db.s.md5): >> md5_list.append(row['md5']) >> random.shuffle(md5_list) >> md5_list=md5_list[:150] >> * >> >> * >> * >> >> *What is the shortest process time to deal with this problem.* >> >> *Thank you in advance.* >> >> * >> * >> >>
-- --- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

