开发者

whats wrong with this query?

开发者 https://www.devze.com 2023-02-04 08:53 出处:网络
INSERT INTO print_development.categories (id, name) VALUES (select id, namefrom print_pro.categories where parent_id is NULL);
INSERT INTO print_development.categories (id, name)
VALUES (select id, name  from print_pro.categories where parent_id is NULL);

You have an error in your SQL syntax; check the manual that corre开发者_如何学编程sponds to your MySQL server version for the right syntax to use near 'select id, name  from print_pro.categories where parent_id is NULL)' at line 2


You have the wrong INSERT/SELECT syntax. You don't use "VALUES", just use the SELECT.

INSERT INTO print_development.categories (id, name)
select id, name  from print_pro.categories where parent_id is NULL

http://dev.mysql.com/doc/refman/5.5/en/insert.html

0

精彩评论

暂无评论...
验证码 换一张
取 消