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

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

How to connect android app to App engine -

hadoop - Running Map Reduce Job shows error - Mkdirs failed to create /var/folders/ -