How to REPLACE updating when it's a subset of the primary key what is duplicated or inserting otherwise?

2009-10-07 Thread Fer C.
Hello I have a table with a compound primary key (a1,a2) and I want to insert a record (b1,b2) in th cases where there's no a1 value matching b1, and if there's already a b1 value in the form (b1,c2) then just update it so that it turns into (b1,b2). So, If I want to insert-update the record

Re: How to REPLACE updating when it's a subset of the primary key what is duplicated or inserting otherwise?

2009-10-07 Thread Fer C.
Thank you for your fast reply! On Wed, Oct 7, 2009 at 6:25 PM, ewen fortune ewen.fort...@gmail.com wrote: Why not use INSERT ON DUPLICATE KEY UPDATE. http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html So, If I want to insert-update the record (a1,b2),b3 the two cases would be: