I would like to update the alt description of an image assigned to a woocommerce product, and set it to the value of product short description.
I can select values like that
<code>SELECT p.post_title, pm.meta_value AS alt_text
FROM mod236_posts
LEFT JOIN mod236_postmeta AS pm ON p.ID = pm.post_id
AND pm.meta_key = '_wp_attachment_image_alt'
WHERE p.post_type = 'attachment'
AND p.post_mime_type LIKE 'image/%';
</code>
<code>SELECT p.post_title, pm.meta_value AS alt_text
FROM mod236_posts
LEFT JOIN mod236_postmeta AS pm ON p.ID = pm.post_id
AND pm.meta_key = '_wp_attachment_image_alt'
WHERE p.post_type = 'attachment'
AND p.post_mime_type LIKE 'image/%';
</code>
SELECT p.post_title, pm.meta_value AS alt_text
FROM mod236_posts
LEFT JOIN mod236_postmeta AS pm ON p.ID = pm.post_id
AND pm.meta_key = '_wp_attachment_image_alt'
WHERE p.post_type = 'attachment'
AND p.post_mime_type LIKE 'image/%';
But I can’t figure out the right MySQL query, this one affect 0 rows
<code>UPDATE mod236_posts AS img
INNER JOIN mod236_postmeta AS sku_meta ON img.post_parent = sku_meta.post_id
SET img.post_excerpt = sku_meta.meta_value
WHERE img.post_type = 'attachment'
AND img.post_mime_type LIKE 'image/%'
AND sku_meta.meta_key = '_sku';
</code>
<code>UPDATE mod236_posts AS img
INNER JOIN mod236_postmeta AS sku_meta ON img.post_parent = sku_meta.post_id
SET img.post_excerpt = sku_meta.meta_value
WHERE img.post_type = 'attachment'
AND img.post_mime_type LIKE 'image/%'
AND sku_meta.meta_key = '_sku';
</code>
UPDATE mod236_posts AS img
INNER JOIN mod236_postmeta AS sku_meta ON img.post_parent = sku_meta.post_id
SET img.post_excerpt = sku_meta.meta_value
WHERE img.post_type = 'attachment'
AND img.post_mime_type LIKE 'image/%'
AND sku_meta.meta_key = '_sku';
Where am I wrong ?