I have a table that has three fields
field_one
field_two
field_three
I’d like to do an insert/update, but instead of checking if one of the key fields already exists, I need to check if (field_one,field_two) combination is already in the database, if so, then update instead of inserting.
Create unique index your_index_name on yourtable (field_one,field_two)(see docs) and use INSERT…ON DUPLICATE KEY UPDATE.MySQL will do the rest automagically.