Python and mySQLdb error: OperationalError: (1054, “Unknown column in 'where clause'”)
问题 Hey all, I'm getting an error OperationalError: (1054, "Unknown column 'XX' in 'where clause'") Where XX is the value of CLASS in the following code conn = MySQLdb.connect(host = "localhost",user = "user", passwd = "pass",db = "dbase") cursor = conn.cursor() cursor.execute("""SELECT * FROM %s WHERE course =%s AND sec = %s""" % (str(DEPT),str(CLASS),str(SEC),)) The thing is, I only get this error with certain values, namely, when CLASS contains a letter. I have the table set up as varchar if