$ sqlite3 dest.sdb
> ATTACH '/home/gary/weewx.sdb' AS SOURCE;
> UPDATE archive SET outTempDay = (SELECT SOURCE.archive.outTemp FROM SOURCE.archive WHERE SOURCE.archive.dateTime = archive.dateTime) WHERE EXISTS (SELECT * FROM SOURCE.archive WHERE SOURCE.archive.dateTime = archive.dateTime);
# create a temporary table with the desired fields and records from the archive table
sqlite3 weewx.sdbSQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table temptable(dateTime,usUnits,interval,extraTemp1);
sqlite> insert into temptable select dateTime,usUnits,interval,extraTemp1 from archive where extraTemp1 is not null;
sqlite> .quit
# dump the temporary table to a dump file, then nuke the temporary table to clean up your weewx.sdb database
echo ".dump weewx_wd" | sqlite3 weewx.sdb > weewx-wd.dump
echo "drop table weewx_wd;" | sqlite3 weewx.sdb
# restore the .dump file, changing the table name you'll create to be 'archive' for consistency
cat weewx-wd.dump | sed -e s/temptable/archive/g | sqlite3 weewx-wd.sdb
sqlite3 weewx.sdb
.schema archive
.quit
sqlite3 dest.sdb
ATTACH 'weewx.sdb' as WW;
INSERT INTO warchive SELECT * FROM WW.archive;
UPDATE archive SET outTempDay = (SELECT warchive.outTemp FROM warchive WHERE archive.dateTime = warchive.dateTime) WHERE EXISTS (SELECT * FROM warchive WHERE archive.dateTime = warchive.dateTime);
DROP TABLE warchive;
.quit
sqlite3 dest.sdb "VACUUM;"
--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/oCF6kmcoEwc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
ATTACH 'weewx.sdb' as WW;
INSERT INTO warchive SELECT * FROM WW.archive;
UPDATE archive SET outTempDay = (SELECT warchive.outTemp FROM warchive WHERE archive.dateTime = warchive.dateTime) WHERE EXISTS (SELECT * FROM warchive WHERE archive.dateTime = warchive.dateTime);
DROP TABLE warchive;
.quit
dest.sdb will still be somewhat bloated despite dropping the table so do an sqlite VACUUM. From the bash prompt:sqlite3 dest.sdb "VACUUM;"