5
I didn’t want to have to do two transactions in the database, currently I’ve been doing SELECT
first to know if the record already exists in the table, then I do either INSERT
or UPDATE
depending on the case, would you like to do despite a transaction is possible? something like INSERT .... IF NOT EXISTS THEN UPDATE ...
?
Are you using a framework? What language? In the Laravel has a method called Createorupdate, checks if it has the record and if it does not have according to the condition it creates.
– Alvaro Alves
Or you can create a Trigger
– Alvaro Alves