Hi Anthony, Thanks for your reply.
Does this work: > > label_count = db.vtx_label.id.count() > count = rowset.select(label_count, join=join).first()[label_count] > > Yes, that works, but I don't understand why it works, could you please explain how your solution works? The table vtx_labels contains lots of labels, does label_count count them all? This is the working code: labels = db(db.vtx_label.vertexID==vertexID)._select(db.vtx_label.label) join = db.vtx_vertex.on((db.vtx_label.vertexID==db.vtx_vertex.id) & (db.vtx_vertex.typeID==IOTHINGID)) rowset = db((db.vtx_label.label.belongs(labels)) & (db.vtx_label.vertexID!=vertexID)) label_count = db.vtx_label.id.count() count = rowset.select(label_count, join=join).first()[label_count] rows = rowset.select(join=join) Best, Annet -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.