1

Basically, I want something like this in standard sql or sqlite:

if(record exists)
{
UPDATE record row;
}
else
{
INSERT record;
}

I have tried using "IF EXISTS(SELECT * FROM table WHERE value = somevalue) UPDATE else INSERT but this is not supported by standard sql or sqlite.

Jason
  • 35
  • 3
  • [This question](http://stackoverflow.com/q/2662425/4519059) for ANSI SQL and [this question](http://stackoverflow.com/q/31429300/4519059) for SQLite can help you ;). – shA.t Jul 26 '15 at 05:51

1 Answers1

0

Try using REPLACE command. It basically is called an alias for INSERT or REPLACE in the documentation.

So now, you just do REPLACE record.

Hope this helps! :)

Awanish Raj
  • 1,631
  • 12
  • 15