A
A
aial2016-12-15 13:16:48
Flask
aial, 2016-12-15 13:16:48

How to select the last row from a filtered row?

ResSeats.query.filter_by(res_id=sessio.film_id).first()
this code selects the first matched row, but how to select the last row from the matched ones?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Peter, 2016-12-15
@petermzg

Flip selection?
.order_by(...).first()

P
pcdesign, 2016-12-15
@pcdesign

ResSeats.query.filter_by(res_id=sessio.film_id).order_by(res_id.desc()).limit(1)

something like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question