• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 531
  • Last Modified:

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
0
rgb192
Asked:
rgb192
2 Solutions
 
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now