MySQL Tip: Forget what I said, Use "REPLACE" instead of INSERT IGNORE
The other day, I posted a quick tip on using INSERT IGNORE to avoid duplicate keys. Well this is embarrassing but I take it all back, do not use that tip. Why? Well I should have read the docs properly - using IGNORE instructs MySQL to ignores all errors which is less that ideal. D'oh!
Instead I've found that using "REPLACE" instead of INSERT works great for MySQL. eg.
REPLACE INTO subscribed_projectmessage_users( projectmessageId, userId )
VALUES( #getProjectMessageId.projectmessageId#, #notifyUserId# )