I want to execute this statement in the mysql database. But I can't get the format right. The ? is replacing a table name not a value. I have tried to concatenate the string together also but the same result.
Tried executing the same insert that I do from Mysql workbench without problems. But still won't work
mysql.connector.errors.DataError: 1136 (21S01): Column count doesn't match value count at row 1
import mysql.connector    
for table in tables:
    sql = """insert into close_price
    select * from nn_indexes_20180105
    where identifier = 'OMXS30'
    and seconds_offs = (select max(seconds_offs) as seconds_offs 
    from nn_indexes_20180105 
    where seconds_offs <= 55800
    and identifier = 'OMXS30');"""
 
    