Jump to content
thirty bees forum

How to make this update SQL


Smile

Recommended Posts

I would like to have the query as shown here but then for all fields in the categories.
 
update ps_product_lang dest
inner join ps_product_lang src on dest.id_product = src.id_product AND dest.id_shop = src.id_shop AND src.id_lang = 6
set
dest.description = src.description,
dest.description_short = src.description_short,
dest.link_rewrite = src.link_rewrite,
dest.meta_description = src.meta_description,
dest.meta_keywords = src.meta_keywords,
dest.meta_title = src.meta_title,
dest.name  =src.name,
dest.available_now = src.available_now,
dest.available_later = src.available_later
where dest.id_lang = 7 AND dest.id_product IN (1499, 1498, 1471, 1497, 1495, 1494, 1492, 1470, 1454, 1493)

I use this to do some translation trick to copy a language 6 and copies it to language 7.

In attached the fields which I would like to copy. Maybe metatags is not possible? Maybe someone know how to do it? 
 
I am a true noob in sql 😉

Catagories.JPG

Link to comment
Share on other sites

10 hours ago, Smile said:
I would like to have the query as shown here but then for all fields in the categories.
 

update ps_product_lang dest
inner join ps_product_lang src on dest.id_product = src.id_product AND dest.id_shop = src.id_shop AND src.id_lang = 6
set
dest.description = src.description,
dest.description_short = src.description_short,
dest.link_rewrite = src.link_rewrite,
dest.meta_description = src.meta_description,
dest.meta_keywords = src.meta_keywords,
dest.meta_title = src.meta_title,
dest.name  =src.name,
dest.available_now = src.available_now,
dest.available_later = src.available_later
where dest.id_lang = 7 AND dest.id_product IN (1499, 1498, 1471, 1497, 1495, 1494, 1492, 1470, 1454, 1493)

I use this to do some translation trick to copy a language 6 and copies it to language 7.

In attached the fields which I would like to copy. Maybe metatags is not possible? Maybe someone know how to do it? 
 
I am a true noob in sql 😉

 

You have to change database tables to ps_category_lang, and slightly adjust columns -- categories don't have short description, or availablility fields.

Result should look like this

UPDATE ps_category_lang dest
INNER JOIN ps_category_lang src ON (dest.id_category = src.id_category AND dest.id_shop = src.id_shop AND src.id_lang = 6)
SET dest.description = src.description,
    dest.link_rewrite = src.link_rewrite,
    dest.meta_description = src.meta_description,
    dest.meta_keywords = src.meta_keywords,
    dest.meta_title = src.meta_title,
    dest.name = src.name
WHERE dest.id_lang = 7 
  AND dest.id_category IN (3, 4, 5)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...