Guys, I have a problem and can not solve, I'll describe it below
I have three tables
##Person## ##Status##
##Situation##
--name-- --id-- --id-- --status--
--id_person-- --id_status--
fernando 1 1 INICIADO
1 1
ricardo 2 2 ADAMENTO
1 2
evandro 3 3 OK
1 3
manolo 4 4 CANCELADO
2 1
2 4
I need to show the person's name and the last situation, using DAL
>> fernando ----- OK
>> ricardo ------- CANCELADO
>> evandro ------ null
>> manolo ------- null
-------------------------------------------------------------------------------
with got the query, but id_situation field comes with the first record, and
not the last
db(db.person).select(db.person.name, db.situation.id_status,
left=db.situation.on((db.person.id
<http://db.emprestimo.id/>==db.situation.id_person),
distinct=db.person.name)
I figured out how to bring the last record >> db(db.situation.id_person ==
db.person.id <http://db.emprestimo.id/>).select().as_list()[-1]['id_status']
Perhaps by combining the queries I would have the result, but I can not
------------------------------------------------------------------------------
If anyone can help me, I'll be grateful
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.