0

我在 wordpress 库中做了自己的自定义表格,现在我需要使用 wopdpress 表格中的数据更新表格(thundbail 链接)

这里选择查询

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(完整产品 = 图像)

第1552章 网址


我尝试使用此代码更新此表

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

但是这个查询不起作用。你能检查一下吗?

4

1 回答 1

0

您使用的方式UPDATEINNER JOIN语法错误,正确的语法是

UPDATE full_products a
LEFT JOIN wp_postmeta AS pm
ON a.postid = pm.post_id
LEFT JOIN wp_posts AS p 
ON pm.meta_value=p.ID
SET a.image = pm.guid
WHERE pm.post_id = 1552
AND pm.meta_key = '_thumbnail_id' 
于 2013-05-26T07:53:38.897 回答