mysql插入SELECT语法错误修复

时间:2014-07-21 11:16:16

标签: mysql

    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文档来获取有关错误的可能想法,但无法找到它。

1 个答案:

答案 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";