Hi, I am trying to run a query with the web2py "belongs" statement where sometimes the value passed to the belongs may be empty. For example,
a=[] rows = db(db.food.id.belongs(a)).select() The database I'm using is MySQL and I get the following error: Traceback (most recent call last): File "<input>", line 1, in <module> File "gluon/sql.py", line 3111, in select rows = response(query) File "gluon/sql.py", line 3106, in response db._execute(query) File "gluon/sql.py", line 932, in <lambda> self._execute = lambda *a, **b: self._cursor.execute(*a, **b) File "build/bdist.linux-x86_64/egg/MySQLdb/cursors.py", line 173, in execute self.errorhandler(self, exc, value) File "build/bdist.linux-x86_64/egg/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1") Any ideas? Avik