I know about INSERT ... ON DUPLICATE KEY UPDATE
but that won't work because the criteria that I will use to check for an existing row is not a unique or primary key. In fact, it will be 2 different fields. It couldn't even be unique key because the values will not be unique.
This is my dummy insert statement
INSERT INTO
videos
(
first_name,
last_name,
addresss,
plan
)
VALUES
(
:first_name,
:last_name,
:addresss,
:plan
)
So I want to say if there's a row already WHERE last_name = :last_name AND plan = :plan
, then update it, otherwise, add a new row.
I could do this with multiple queries, but I'm just trying to see if there's a way to do this with one shot without going back and forth with it. This will be done in a loop, so if I have to do it in multiple queries it will probably double the number of queries.