MySQL Insert Where query

前端 未结 27 2383
悲&欢浪女
悲&欢浪女 2020-11-22 06:16

What\'s wrong with this query:

INSERT INTO Users( weight, desiredWeight ) VALUES ( 160, 145 ) WHERE id = 1;

It works without the WHE

27条回答
  •  南旧
    南旧 (楼主)
    2020-11-22 07:01

    You can do that with the below code:

    INSERT INTO table2 (column1, column2, column3, ...)
    SELECT column1, column2, column3, ...
    FROM table1
    WHERE condition
    

提交回复
热议问题