Posted By

Zwendel on 10/27/09


Tagged

insert key unique duplicate update


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

dantreacy
kubaitis
kidmizere
virendrakryadav


Insert or update if unique key already exist


 / Published in: MySQL
 

  1. INSERT INTO `tableName`
  2. VALUES (?,?,?,'-1',?,'0')
  3. ON DUPLICATE KEY
  4. UPDATE `id` = ?, `foo` = ?, `bar` = ?

Report this snippet  

You need to login to post a comment.