Can I update multiple row with multiple table in MySQL with join query from my join query, can someone give me some example.
This my query:
SELECT
p.ID,
p.post_date,
p.post_modified,
p.post_title,
p.post_status,
p.post_type,
GROUP_CONCAT(distinct t_cat.name separator ', ') as category,
GROUP_CONCAT(distinct t_tag.name separator ', ') as tags,
CONCAT('[',GROUP_CONCAT(distinct JSON_OBJECT('key', pm.meta_key,'value',pm.meta_value)),']') as meta
FROM wp_c3g3f5_posts p
JOIN wp_c3g3f5_postmeta pm ON pm.post_id = p.ID AND pm.meta_key IN (
'_sku',
'_stock',
'_stock_status',
'_visibility',
'_weight',
'_width',
'_height',
'_length',
'_featured',
'_regular_price',
'_sale_price')
JOIN wp_c3g3f5_term_relationships tr ON tr.object_id = p.id
LEFT JOIN wp_c3g3f5_term_taxonomy tt_cat ON tt_cat.term_taxonomy_id = tr.term_taxonomy_id AND tt_cat.taxonomy IN ('product_cat')
LEFT JOIN wp_c3g3f5_terms t_cat ON t_cat.term_id = tt_cat.term_id
LEFT JOIN wp_c3g3f5_term_taxonomy tt_tag ON tt_tag.term_taxonomy_id = tr.term_taxonomy_id AND tt_tag.taxonomy IN ('product_tag')
LEFT JOIN wp_c3g3f5_terms t_tag ON t_tag.term_id = tt_tag.term_id
WHERE p.ID = ?
GROUP BY p.ID
我不太明白你的问题,但如果你想根据其他表中的数据更新表中的多行,是的,这是可能的,如果你想更新多个不同表中的多行,那只会可以通过使用存储过程或类似的东西。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.