INSERT INTO `yr8tu_posts` NULL,"1538",Replace(meta_value,".jpg",""),"","publish","open","open",,Replace(meta_value,".jpg",""),post_id,"","0","attachment","image/jpeg","0")
SELECT meta_value, post_id FROM `yr8tu_postmeta` WHERE meta_key = "_wp_attached_file";
上面是我用于INSERT SELECT语句的查询,但它不断给出语法错误。我也尝试通过mysql文档来获取有关错误的可能想法,但无法找到它。
答案 0 :(得分:0)
像这样......
INSERT INTO `yr8tu_posts`
SELECT NULL
, "1538"
, REPLACE(meta_value,".jpg","")
, ""
, "publish"
, "open"
, "open"
, ""
, REPLACE(meta_value,".jpg","")
, post_id
, ""
, "0"
, "attachment"
, "image/jpeg"
, "0"
, meta_value
, post_id
FROM `yr8tu_postmeta`
WHERE meta_key = "_wp_attached_file";