что не так с этим запросом?

0
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 corresponds 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
Теги:

1 ответ

4
Лучший ответ

У вас неправильный синтаксис INSERT/SELECT. Вы не используете "VALUES", просто используйте 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
    Точно, но неправильная страница руководства: dev.mysql.com/doc/refman/5.5/en/insert-select.html
  • 0
    +1 Я никогда не знал этого раньше

Ещё вопросы

Сообщество Overcoder
Наверх
Меню