Hi, using Web2py 2.8.1 and doing a query where you need to for example add two values of a table to query data such as:
table1 ------------------------- id | field1 | fIeld2 ------------------------- 1 | 1 | 2 2 | 3 | 5 ... so i wanted to have all rows that (db.table1.field1 + db.table1.field2)>4 I would just do db(((db.table1.field1 + db.table1.field2)>4)).select() But in 2.8.1 (as is the only version i've to test) that would result in an incorrect: SELECT table1.id, table1.field1, table1.field2 FROM table1 WHERE (CONCAT(CAST(db.table1.field1), CAST(db.table1.field2))>4); wich is not what i want. I want the standard addition in the SQL Statement like: SELECT table1.id, table1.field1, table1.field2 FROM table1 WHERE ((db.table1.field1 + db.table1.field2)>4); So i've changed Line 1431 of dal.py -- if self.is_numerical_type(first.type): ++ if self.is_numerical_type(first.type) or isinstance(first.type, gluon.dal.Field): And that fixes it. -- 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/groups/opt_out.