sql = "SELECT DISTINCT TradingDay FROM %s WHERE TradingDay <= %s ORDER BY TradingDay DESC"
cur.execute(sql, ("new_beta", '2010-01-05'))
报错
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 ''new_beta' WHERE TradingDay <= '2010-01-05' ORDER BY TradingDay DESC' at line 1")
应该是表明那地方用的"new_beta",%s进去的,还是有两个单引号,出现这种'new_beta' WHERE TradingDay <= '2010-01-05' ORDER BY TradingDay DESC,请问有什么办法去掉引号呢
Solved,