Michael Miller wrote: > "If the string doesn't exist in the table, create a new row with > the string in the first column and 1 in the second column. If > the string does exist in the table, increment the second column > by 1"
One way you can do it is to insert everything into a temporary table which doesn't require the string to be unique, and then do a select sum(count),string from temp group by string; create table mystrings (string text primary key, count integer); create table mytemp (string text, count integer); .import mydata.txt mytemp insert into mystrings (string, count) select string, sum(count) from mytemp group by string; As a complement to the "insert or replace" it would be nice to have "insert or accumulate" for this kind of a job. However, that would go outside of the SQL standard. -- Lars Aronsson ([EMAIL PROTECTED]) Aronsson Datateknik - http://aronsson.se _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users