I'm attempting to create a set of rows containing items (t_table1) which have an image (t_table1_image) associated with them, or which are referenced by an entry in another table (t_table2), with an image (t_table2_image) associated with that entry. I would like the corresponding rows object not to contain any rows that have the same value for 'f_table2_id' as any other rows. That is, the set of 'f_table2_id' values for the rows object should not contain any duplicates, with the exception of null values. The current query and select operation are like this:
# f_table1_id is a reference field pointing to table1's id field # f_table2_id is a reference field pointing to table2's id field query_table1_entry_has_image = (self.db.t_table1.id == self.db.t_table1_image.f_table1_id) query_table1_references_table2 = (self.db.t_table1.f_table2_id == self.db.t_table2.id) query_table2_entry_has_image = (self.db.t_table2.id == self.db.t_table2_image.f_table2_id) query_list = [query_table1_has_image | (query_in_table2 & query_table2_has_image)] ... query list extended further ... query = self.reduce_db_queries(query_list, 'and') rows = self.db(query).select(orderby = '<random>', limitby = (0, number_of_rows)) How should this be modified so that select returns a 'rows' object that does not contain any row that has the same 'f_table2_id' value as another row? Thank you. -- 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.