从一个表导入到另一个表..这个错误。
INSERT INTO wp_users (DEFAULT, user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_status, display_name)
SELECT ID, username, password, LOWER(username), email, company_url, date_added, '0', username
FROM user
WHERE ID BETWEEN 5000 to 10000;
我只是不想插入ID,因为它在wp_users
中自动递增,所以我使用“DEFAULT”。
错误:#1064 - 您的SQL语法出错;检查手册 对应于您的MySQL服务器版本,以获得正确的语法 在'DEFAULT,user_login,user_pass,user_nicename,user_email附近使用, user_url,user_regist'在第1行
答案 0 :(得分:1)
DEFAULT
,user
是MySQL中的保留字,逃避它们。谓词BETWEEN
也应该是BETWEEN ... AND ...
而不是BETWEEN ... TO ...
:
INSERT INTO wp_users (`DEFAULT`, user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_status, display_name)
SELECT ID, username, password, LOWER(username), email, company_url, date_added, '0', username
FROM `user`
WHERE ID BETWEEN 5000 AND 10000;