Ok, let's say from start I'm not a SQL ninja. Anyway I'm using SQLite in a tiny project of mine. I've this test table:
CREATE TABLE [prova]
(
[id] INTEGER PRIMARY KEY UNIQUE,
[str] TEXT NOT NULL
)
and this query won't work:
insert into prova (id, str)
select null as id, "foo" as str
where not exists (select * from prova where prova.str = "foo")
why this??? I need to do conditional inserts and I'm seeking a way to make them faster