I am trying to insert into a table. This is the code I made:
cursor=connection.cursor()
cursor.execute('INSERT INTO TopOperadores (imsi_pref_top,descarga_top,transferencia_top) VALUES (SELECT imsi_num, AVG(descarga), AVG(transferencia) FROM Trafico_de_Datos group by nomb_oper)')
This is the error:
syntax error at or near "SELECT" LINE 1: ..._pref_top,download_top,transfer_top) VALUES (SELECT ims...
It is not necessary to add
VALUES
to your query since you determined 3 fields in which the values of the will be insertedSELECT
, the correct thing would be: