mysql - SQL mass insert based off of data pulled from another table -


i don't know if worded correctly, i'll try explain want.

table 1 - x id | name | blah  table 2 - y id | xid | configkey | configval 

what want is, create row in table 2 in table 1, corresponding id table 1 goes column xid in table 2. i'm java background , not keen on sql, not sure how this. there lot of rows in table 1, why script out.

i pretty want this:

table1 (the object table) 1 test1 2 test3 b 3 testn n 

run query populate this

table 2 (the config table) ...exisitng rows 59 1 dosomething true 60 2 dosomething true 61 3 dosomething true 

so, pretty want add in config row (all same values) except id corresponds (column 2 in table 2 should col 1 table 1)

thanks

to use fixed values 'dosomething' , 'true' inserted records:

insert table2 (xid, configkey, configval) select id, 'dosomething', 'true' table1 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -