bug 1281: Fix syntax error in SQL statement