http://web2py.com/books/default/chapter/29/6#find,-exclude,-sort

On Thursday, July 12, 2012 8:16:20 AM UTC-4, Najtsirk wrote:
>
> I did manage to do this on my own. But the problem is ordering. I cannot 
> get the records in the right order.
>
> I did manage to get the rows like:
>
> Table 1 - Record 1
> Table 1 - Record 2
> Table 1 - Record 3
> Table 2 - Record 1
> Table 2 - Record 2
> Table 2 - Record 3
>
> But how can i get output orderd by weight (which is a integer field in 
> both tables), like:
>
> Table 1 - Record 2 - Weight 1
> Table 2 - Record 3 - Weight 2
> Table 2 - Record 1 - Weight 3
> Table 1 - Record 3 - Weight 4
> Table 2 - Record 2 - Weight 5
> Table 1 - Record 1 - Weight 6
>
>
>
> On Thursday, 12 July 2012 13:31:49 UTC+2, villas wrote:
>>
>> I forgot that you need to add different tables,  try something like this 
>> instead...
>>
>> a=db.auth_user.with_alias('a')
>> r1 = db(a.id==1).select(a.id)
>>
>> a=db.auth_group.with_alias('a')
>> r2 = db(a.id==1).select(a.id)
>>
>> rows_all = r1 & r2
>>
>>

Reply via email to