Loading...

sqlite-users@sqlite.org

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

[sqlite] Help request for a query... Jörgen Hägglund Sun Feb 19 08:01:13 2012

Hi all!
I'm not sure if it's my brain melting or what it might be... :-)
I have a table defined as:
CREATE TABLE IF NOT EXISTS History (Path TEXT UNIQUE NOT NULL, Hits INTEGER DEFAULT 0)

Is there any way of making inserting data as follows;
- If Path does not exist in the table;
INSERT INTO History VALUES ('c:\', 1)
Should yield:
c:\,1

- But, if Path already exists do this:
UPDATE History SET Hits = Hits + 1 WHERE Path = 'c:\'
Should yield:
c:\,2

Of course, the 'c:\' is entered programmatically (using params).

Anyone up for modifying, explaining and solving this? :-)

Best regards,
/Jörgen

 *
 * Engelska
 * Svenska
 * Franska
 * Tyska

 * Engelska
 * Svenska
 * Franska
 * Tyska

<javascript:void(0);>
_______________________________________________
sqlite-users mailing list
[EMAIL PROTECTED]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users