INSERT ... IGNORE from another table

3.7k views Asked by At

I want to insert some records that comes from a table into another table using INSERT ... IGNORE:

INSERT IGNORE into separa (no_cliente,contratante) values (select cl_num,cl_aseg from clientes)

But MySQL tells that I'm wrong, any help?

1

There are 1 answers

0
BlitZ On

Remove VALUES and braces, exclude SELECT:

INSERT IGNORE INTO separa (no_cliente, contratante)
SELECT cl_num, cl_aseg FROM clientes;

Read more here.