Copy rows and insert in source table
In MySQL I have a table design like this:
Language|Key|Text
Language and Key are primary keys. A content example could be:
("ENU","P_Home_H2","Welcome to my page"),
("ENU","P_Home_P1","Hello world!")
Now I want to copy all rows with Language="开发者_开发技巧ENU" to Language="ESP", ie select all rows where Language = "ENU" and insert into same table, with same Key and Text but Language="ESP". The result would be:
("ESP","P_Home_H2","Welcome to my page"),
("ESP","P_Home_P1","Hello world!")
How do I do this?
Insert into MyTable
Select 'ESP' as Language, Key, Text
From MyTable
Where Language = 'ENU'
INSERT INTO existingTable
Select 'ESP' as Language, [Key], Text
FROM newTable
WHERE Language = 'ENU'
精彩评论