Hi
I need to update date a value in table if it does not exist then it must be inserted
What is the best way to does this in MySql
Currently I am using
SELECT Id INTO LId FROM ATABLE WHERE ID = FID;
IF LId IS NULL THEN
INSERT INTO ATABLE(abc) Values (2)
ELSE
UPDATE ATABLE Set Abc = 2 Where Id = LId
END IF;
But this hits the Database 3 times
Is there a better way of doing this ?