I am in need to insert a row in a table if it does not exist, or update it otherwise, but based in a column that is not unique or primary.
I am doing the insert part with :
INSERT INTO table (`match`, `to`, `status`, `type`, cat, rel, tag) VALUES ('$match_tag', '$match_tag_url', '1', 'redirection', 'confirmed', '', '$tag')
but if match
exists already I'd like to update the to
value, all in one query if possible.
I apologise in advance for the novice question and thank everyone for any input.
I am thinking the solution might relate to the ON DUPLICATE KEY UPDATE
statement, but all the examples I have found so far involve a unique or primary item which I do not have in my case.