看一下这段SQL哪儿错了?
SQL code
UPDATE comment
SET
comment.user_id =wp_comments.user_id,
comment.comment_approved =wp_comments.comment_approved,
comment.comment_parent =wp_comments.comment_parent,
comment.comment_content =wp_comments.comment_content,
comment.comment_date =wp_comments.comment_date,
comment.comment_author_IP =wp_comments.comment_author_IP,
comment.comment_author_email =wp_comments.comment_author_email,
comment.comment_author =wp_comments.comment_author
from comment,wp_comments
where comment.comment_ID = wp_comments.comment_ID
错误:#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from comment,wp_comments where comment.comment_ID = wp_comments.comment_ID' at line 11
是phpmyadmin 提示的。
------解决方案--------------------
UPDATE comment INNER JOIN wp_comments ON comment.comment_ID = wp_comments.comment_ID
SET
comment.user_id =wp_comments.user_id,
comment.comment_approved =wp_comments.comment_approved,
comment.comment_parent =wp_comments.comment_parent,
comment.comment_content =wp_comments.comment_content,
comment.comment_date =wp_comments.comment_date,
comment.comment_author_IP =wp_comments.comment_author_IP,
comment.comment_author_email =wp_comments.comment_author_email,
comment.comment_author =wp_comments.comment_author
------解决方案--------------------
你的写法是sqlserver的
应该
UPDATE comment,wp_comments
SET
comment.user_id =wp_comments.user_id,
comment.comment_approved =wp_comments.comment_approved,
comment.comment_parent =wp_comments.comment_parent,
comment.comment_content =wp_comments.comment_content,
comment.comment_date =wp_comments.comment_date,
comment.comment_author_IP =wp_comments.comment_author_IP,
comment.comment_author_email =wp_comments.comment_author_email,
comment.comment_author =wp_comments.comment_author
where comment.comment_ID = wp_comments.comment_ID