On 09/06/2011 12:50, Vasile Ermicioi wrote:
db(db.power_curve).select(orderby=~db.power.id,
group_by=db.power_curve.site)
no, it doesn't get the expected result
at the moment I solved filtering the query in a second time using
another query that involves a max function:
last_pc = db.power_curve.validity.max()
sites = db(db.power_curve).select(
orderby=db.power_curve.site)
sites_selection = sites.find(lambda row: (row.site.id,
row.power_curve.start, ) in \
db(db.power_curve).select(db.power_curve.site, last_pc,
groupby=db.power_curve.site).response)