Reputation: 5042
I have a table used by cms which holds data for several languages. If i'd like to add another language i would have copy existing pages(all of some language) only with a change value in column 'lang'.
How to copy row and change value of one column which will put to the same table?
Thanks
Upvotes: 0
Views: 60
Reputation: 4374
You'd do this with a statement like:
insert into <table_name> (language, value1, value2)
select 'new_language', value1, value2
from <table_name>
where language = 'old_language'
as per the manual: http://dev.mysql.com/doc/refman/5.5/en/insert-select.html
Upvotes: 0
Reputation: 50034
INSERT INTO foobar (lang,text)
SELECT 'de',text
FROM foobar
WHERE lang='en';
Upvotes: 1