copy values from existing table into new table

table1  
varchar column1
varchar volumn2


new empty
table2
varchar column1


copy table1.column1 into table2.column1 where table1.column2 is not null
LVL 1
rgb192Asked:
Who is Participating?
 
larsrohrCommented:
It sounds like you are interested in the INSERT INTO ... SELECT syntax.
See, for instance, MySQL 5.5 documention

INSERT INTO table2 (column1)
    SELECT table1.column1
    FROM table1 WHERE table1.column2 IS NOT NULL;
0
 
arnoldCommented:
It is rather not clear why you need this, creating a view might be a better approach to have the same info that will be continually updated.
0
 
rgb192Author Commented:
thank you

also thanks for advice about view which I did not use yet
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.