Reputation: 687
Importing from one table to another.. this errors.
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;
I just don't want the ID inserted as it's auto-incremented in wp_users
so I'm using "DEFAULT".
Error: #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 'DEFAULT, user_login, user_pass, user_nicename, user_email, user_url, user_regist' at line 1
Upvotes: 1
Views: 137
Reputation: 79929
DEFAULT
, user
are reserved words in MySQL, escape them. Also the predicate BETWEEN
should be BETWEEN ... AND ...
not 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;
Upvotes: 1