title: Python and mySQLdb error: OperationalError: (1054, "Unknown column in 'where clause'")
body: <p>Hey all, I'm getting an error </p>
  
  <blockquote>
    <p>OperationalError: (1054, "Unknown column 'XX' in 'where clause'")</p>
  </blockquote>
  
  <p>Where XX is the value of CLASS in the following code</p>
  
  <pre><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),))
  </code></pre>
  
  <p>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 that helps</p>
  
  <p>Thanks!</p>