Hey Vasile: The end select would give an error.. belongs() translates to a:
" db.logs.item IN ( SELECT db.logs.date, db.logs.item [..] )" "ERROR: subquery has too many columns" If the tables had id fields this technique could actually work tho... thanks! beto On Sat, Jan 29, 2011 at 4:13 AM, Vasile Ermicioi <elff...@gmail.com> wrote: > _sql1 = db(db.logs.date.year()==2010)._select(db.logs.date, > db.logs.item, groupby=db.logs.item) > rows = db(db.logs.item.belongs(_sql1) & (db.stock.item == > db.logs.item)).select(db.logs.date,db.logs.item.count(), > groupby=db.logs.date) > notice _select for the first query