I am new to SQLite.
I am looking for IF ELSE
in SQLite to perform UPDATE
OR INSERT
operation based on the condition check.
What I tried is:
IF EXISTS(SELECT 1 FROM TblTest WHERE ID = 1 AND Name = 'XYZ')
BEGIN
END
UPDATE TblTest
SET Address = 'NYC',
Mobile='102938340'
WHERE ID = 1 AND Name='XYZ'
ELSE
BEGIN
INSERT INTO TblTest(ID,Name,Address,Mobile)
VALUES(1,'XYZ','NYC','102938340');
END
Getting an error:
Result: near "IF": syntax error