查询表达式中的语法错误,SQL 通过 PYODBC
Syntax error in query expression, SQL via PYODBC
确切的错误信息是:
ProgrammingError: ('42000', "[42000] [Microsoft][ODBC Microsoft Access Driver] Syntax error (comma) in query expression 'occupied = False, electric = False, family = False, disabled = False'. (-3100) (SQLExecDirectW)")
我到处都看了,但不明白我做错了什么,有问题的行如下:
spacelist = cursor.execute("SELECT space, distance1, distance2, distance3, distance4, distance5 FROM spaces WHERE occupied = False, electric = True")
试试这个:
spacelist = cursor.execute("SELECT space, distance1, distance2, distance3,
distance4, distance5 FROM spaces WHERE occupied = False AND electric = True")
确切的错误信息是:
ProgrammingError: ('42000', "[42000] [Microsoft][ODBC Microsoft Access Driver] Syntax error (comma) in query expression 'occupied = False, electric = False, family = False, disabled = False'. (-3100) (SQLExecDirectW)")
我到处都看了,但不明白我做错了什么,有问题的行如下:
spacelist = cursor.execute("SELECT space, distance1, distance2, distance3, distance4, distance5 FROM spaces WHERE occupied = False, electric = True")
试试这个:
spacelist = cursor.execute("SELECT space, distance1, distance2, distance3,
distance4, distance5 FROM spaces WHERE occupied = False AND electric = True")