Aryan Aryan - 4 months ago 24
MySQL Question

Inner join update query not running

Error in the mysql syntax .I have used two tables to join them using inner join

update wp_postmeta
set sku.meta_value=seo.`Meta Description`
From sanitaryseo AS seo
INNER JOIN wp_postmeta AS sku
ON sku.meta_value = seo.`product code`
where sku.meta_key='_yoast_wpseo_metadesc'

Answer

You should define the table and the join in top

update wp_postmeta sku
inner join sanitaryseo seo ON sku.meta_value = seo.`product code`
set  sku.meta_value=seo.`Meta Description`  
where sku.meta_key='_yoast_wpseo_metadesc'; 

And remember that Update clause don't use from .. (the table or the tables joined are in update clause)

Comments