you should join them and then do the ordering. auto-references are a nice facility but comes with a price: you can't use them just like if your records were in a single table to do a select or an update....
db(db.table.refrence == db.refrencedtable.Field).select(db.table.ALL, orderby=db.refrencedtable.Field) On Wednesday, February 27, 2013 10:17:28 PM UTC+1, BlueShadow wrote: > > Hi, > I got two Tables lets call them table and referencedtable. table has a > field which is a reference to referenced table. Now I like to select all > entries from table and order them by a field in the referenced table. In my > opinion it should work like this: > #defauft.py > rows=db().select(db.table.ALL, orderby=db.table.reference.Field) > > #db.py > > db.define_table('refrencedtable', > Field('Field',length=512) > ) > > db.define_table('table', > Field('Title',length=1024), > Field('refrence',db.refrencedtable), > Field('Test','upload') > ) > but when I do this I get an error that referncedtable has no Field called > Field. > > -- --- 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/groups/opt_out.