tags:

views:

40

answers:

1

Let's say I have two tables

lnglngdef:
lngId | lngName
1       Korean
2       Spanish

lngnottranslated:
lngId | engDef
1       Hello
2       Hello
1       Hi
2       Hi

Now I want to insert a new "engDef" with the value 'Welcome' in the lngnottranslated for each entry in the lnglngdef table. In this case that's two new rows in the lngnottranslated table with the lngId 1, 2 and the engDef set to 'welcome' on both entries. I've seen similar questions here but none really help me. Also I know this is not 100% following the normalization rules but this is the way it's implemented and is hard to change.

How would I do this in SQL (using mysql)?

+1  A: 

Something like this?

INSERT INTO lngnottranslated (lngid,engDef) SELECT lngid, 'Welcome' FROM lnglngdef;

Here's the docs about INSERT SELECT

seth
Thank you very much! That worked, will read about INSERT SELECT :)
Baversjo