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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -