Home > database >  The MySQL database, how to make the insert statement is the where condition
The MySQL database, how to make the insert statement is the where condition

Time:01-25

INSERT INTO table name (' field 1 ', '2' field) select '1', 'value 2 from dual where the exists (select ID from the name of the table where ID=' 12345 ')

I root why I wrote the execution result of testing is to add a line of data, not in the where clause for row data insert


My user access only the insert, can write like this

CodePudding user response:

If I had already in a row, insert a few fields, you can use the insert, need not update

These fields are NULL

CodePudding user response:

Update the data must use the update

CodePudding user response:


The original poster can try the merge, maybe can achieve your requirements,
  • Related