On 8/16/2011 4:58 PM, Anantha Prasad wrote: > The data is sorted by Longitude and then by Distance. Whenever there are > repeated values of Distance within a Longitude, I want the Sum and Count to > be added and divided
select Longitude, Distance, sum(SumColz) / sum(CountColz) as AvgColz from my_table group by Longitude, Distance; If you want to replace the original table with this processed data, you can do it in several steps: 1) Create a new table to hold the result. 2) Use INSERT INTO new_table SELECT ... statement to save the result of the aforementioned select. 3) Drop the old table. 4) Use ALTER TABLE statement to rename the new table to the old name. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users