I think, reversing the sort and getting the first record will do.



20-07-2011 16:32, Krishnakant Mane yazmış:
Hello all,
Subject line says it all.
Basically what I want to do is to get last record from a result set.
I am dealing with a situation where given a date I need to know the last
record pertaining to transaction on a given account.
yes, it is an accounting/ book keeping software.
So I thought there was some thing like .last() method for a resultset?
Or even better do we have some thing like session.query(table).last()
The problem is that my logic is in place but I know that performance
wise it is very dirty to get the list of all records, just to loop till
the end and throw away all the rest of the rows.
So plese suggest how can I only get just that one (last) record?
Happy hacking.
Krishnakant.


--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to