Duplicate all rows in sql database table

I have a table containing the details of a house called a property. I am creating a localized application and I have a db table called propertylocalised. This table stores duplicate data columns and cultures, for example.

key culture propertyname 1 en helloproperty 1 fr bonjourproperty 

At the moment I have all my en-culture, but I want to duplicate all these lines, and then insert fr into the culture for each other line.

I obviously want to do this only once to set up localization.

thanks

Andy

+4
source share
2 answers
 INSERT INTO table SELECT 'fr', propertyname FROM table 

Assuming you want to duplicate all existing entries that are "en"

+4
source
 insert into propertylocalised select key,'fr'propertyname from propertylocalised where culture = 'en' 
+2
source

Source: https://habr.com/ru/post/1307514/


All Articles