News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Update sentence (SQL QUERY)

Started by gpessoa, January 28, 2013, 23:26:43 PM

Previous topic - Next topic

gpessoa

Hi
I need to copy a product description from one database to another
The common field is the product_sku.
The problem is that I can't put the update command working, because  product_sku is in other table and has to be Joined by virtuemart_product_id, and I´m missing this...

Can any one write for me this update sentence for me, please?

Tables and Fields:
jos_virtuemart_products
virtuemart_product_id    
product_sku

jos_virtuemart_products_pt_pt
virtuemart_product_id
product_name

Thanks in advanced
J 4.4.4; VM 4.2.6; PHP 8.3.6

gpessoa

#1
This is my sentence, but it gives me this error:
#1066 - Not unique table/alias: ' MyDB_old_virtuemart_products_pt_pt'


UPDATE MyDB_old_virtuemart_products_pt_pt    
INNER JOIN
MyDB_old_virtuemart_products_pt_pt ON MyDB_old_virtuemart_products_pt_pt.virtuemart_product_id = MyDB_old_virtuemart_products.virtuemart_product_id 
INNER JOIN
MyDB_new_virtuemart_products_pt_pt ON MyDB_new_virtuemart_products_pt_pt.virtuemart_product_id = MyDB_new_virtuemart_products.virtuemart_product_id 
LEFT JOIN
MyDB_old_virtuemart_products ON MyDB_old_virtuemart_products.product_sku = MyDB_new_virtuemart_products.product_sku
SET
MyDB_old_virtuemart_products_pt_pt.product_desc = MyDB_new_virtuemart_products_pt_pt.product_desc
WHERE
MyDB_old_virtuemart_products.product_sku = MyDB_new_virtuemart_products.product_sku


J 4.4.4; VM 4.2.6; PHP 8.3.6