Loading...

sqlite-users@sqlite.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [sqlite] Help request for a query... Petite Abeille Sun Feb 19 09:00:07 2012

On Feb 19, 2012, at 4:59 PM, Jörgen Hägglund wrote:

> INSERT INTO History VALUES ('c:\', 1)
> UPDATE History SET Hits = Hits + 1 WHERE Path = 'c:\'

Short of a merge statement, which SQLite lacks, you will indeed need to use two 
statements. 

For example, you could turn your first insert statement into a conditional 
insert:

begin transaction;
insert or ignore into history ...
update history set hits = hits + 1 where ...
end transaction;
_______________________________________________
sqlite-users mailing list
[EMAIL PROTECTED]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users