mysql - Insert selected value to table from another table multiple times -
i have sql table name 'old' one:
old_col1 old_col2 title news post blablabla1 title weather post blablabla2
and want insert table 'new' has columns: title , post
the values of old_col2 table old. table new should this:
title post news blablabla1 weather blablabla2
i tried fill column title query:
insert new (title) select old_col1 old old_col1 = 'title'
you can try below. see example http://sqlfiddle.com/#!9/14841/4
select a.old_col2, b.old_col2 old join old b on a.old_col2 <> b.old_col2;
Comments
Post a Comment