mysql - Copy all records between tables with the exception of a line -


this question has answer here:

i have syntax can copy records tables have same fields:

insert table2 select * table1 id = '7' 

so know how keep copying values ​​except 'id' field (because him primary key , auto increment).

you list columns:

insert table2(col1, . . . coln)     select col1, . . ., coln     table1     id = '7'; 

under circumstances, should list columns explicitly. can run problems when tables have same columns in different order.

(the 1 exception in code write in script table1 created table2 using create table as.)


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -