Is there MySQL.. INSERT … ON DUPLICATE KEY SELECT?

后端 未结 2 1362
刺人心
刺人心 2021-01-18 12:14

is there a way to do an INSERT but on DUPLICATE KEY instead of an update do a SELECT?

2条回答
  •  情歌与酒
    2021-01-18 12:32

    Not in one query, but you coul run INSERT IGNORE and then SELECT . The IGNORE makes it ignore any rows that would trigger duplicate key errors instead of halting.

提交回复
热议问题