9

I have a table which contains house details called property. I am creating a localised application, and I have a db table called propertylocalised. In this table is held duplicates of the data and culture column e.g.

key  culture propertyname

1     en       helloproperty

1     fr       bonjourproperty

At the moment I have all my en culture inserted but I want to duplicate all of those rows and then for every other row insert fr into culture.

I obviously only want to do this once, for the purpose of setting up the localisation.

Thanks

Andy

2 Answers 2

8
INSERT INTO table 
SELECT 'fr', propertyname
FROM table

assuming you want to duplicate all the existing records which are all 'en'

2
insert into propertylocalised select key,'fr'propertyname from propertylocalised  where culture = 'en'
3
  • If 'id' is an autoincrement key, you don't want to insert it.
    – dkretz
    Apr 21, 2010 at 7:07
  • @le dorfier as listed in the OP the key is for both languages the same (1). Therefore I would rather expect the same key.
    – stacker
    Apr 21, 2010 at 7:12
  • there are duplicate keys which relate to the property. Cheers everyone will try this later. Andy Apr 21, 2010 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.