这是我的查询:
insert into unique_products values (product_id, serial_numnber, pronexo_code, entry_time, exit_time, guarantee_long, expanded_guarantee_long)
select product_id, serial_number, pronexo_code, start_guarantee_date, start_guarantee_date, guarantee_long, expanded_guarantee_long
from table_24
它抛出这个错误信息:
#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 'select product_id, serial_number, pronexo_code, start_guarantee_date, start_guar' at line 2
有人知道问题出在哪里吗?我该如何解决?
最佳答案
从您的查询中删除 VALUES
关键字。
试试这个:
INSERT INTO unique_products (product_id, serial_numnber, pronexo_code, entry_time, exit_time, guarantee_long, expanded_guarantee_long)
SELECT product_id, serial_number, pronexo_code, start_guarantee_date, start_guarantee_date, guarantee_long, expanded_guarantee_long
FROM table_24;
关于MySQL - 如何使用 select 语句插入多行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49727641/