How to add a where clause in a MySQL Insert statement?

前端 未结 8 994
刺人心
刺人心 2020-11-30 12:56

This doesn\'t work:

INSERT INTO users (username, password) VALUES (\"Jack\",\"123\") WHERE id=\'1\';

Any ideas how to narrow insertion to a

8条回答
  •  半阙折子戏
    2020-11-30 13:25

    In an insert statement you wouldn't have an existing row to do a where claues on? You are inserting a new row, did you mean to do an update statment?

    update users set username='JACK' and password='123' WHERE id='1';
    

提交回复
热议问题