Prelumination:
I have the Table "baseline" in the Sqlite3-DB. Table "Baseline" has following columns:
- word
- counter
Question: Any ideas how it is possible to let sqlite3 engine (if it is more efficient) do for me following operation:
- if table "baseline" already has an element with primary key "word", than while insertion don't replace this row but do addition between old counter and new counter.
Example
After following Insertions Commands:
"INSERT INTO baseline(word, counter) VALUES 'bla', 1; "
"INSERT INTO baseline(word, counter) VALUES 'bla', 1; "
I want to get the following data from the DB:
>>> "SELECT * FROM baseline;"
'("bla", 2)'
Thx in advance=)
SELECT word, sum(counter) FROM baseline GROUP BY word?