我沒有在WordPress的基礎自定義的表,現在我需要更新使用數據從wopdpress的表(thundbail鏈接)MySQL的更新數據,3臺
這裏選擇查詢表
SELECT p.post_parent, guid
FROM wp_postmeta AS pm
INNER JOIN wp_posts AS p ON pm.meta_value=p.ID
WHERE pm.post_id = 1552
AND pm.meta_key = '_thumbnail_id'
ORDER BY p.post_date DESC
LIMIT 1
答案: post_parent(fullproducts = postid)| guid(fullproducts = image)
1552 | URL
我tryed此代碼更新此表
UPDATE full_products, wp_postmeta AS pm
SET full_products.image = wp_postmeta.guid
INNER JOIN wp_posts AS p ON pm.meta_value=p.ID
WHERE pm.post_id = full_products.postid
AND pm.post_id = 1552
AND pm.meta_key = '_thumbnail_id'
ORDER BY p.post_date DESC
LIMIT 1
但此查詢行不通。你能檢查一下嗎?
在'UPDATE'語句'INNER JOIN'是放錯了地方;把它放在'SET'關鍵字之前,與其他表一起。 – eggyal