None of the other questions which address this error seems to work for me. My query is:
IF NOT EXISTS (SELECT 1 FROM Configuration WHERE key = 'CookieCount')
BEGIN
INSERT INTO Configuration (key, value)
VALUES ('CookieCount', '0')
END
and my error message is: "could not prepare statement (1 near "IF": syntax error)"
I have this working in Postgres: http://sqlfiddle.com/#!15/b14ef/2/0 But this does not work in SQLite and I need it to work with both.