Op 9 jun 2013, om 16:35 heeft Igor Tandetnik het volgende geschreven:

On 6/9/2013 4:55 AM, Dave Wellman wrote:
For this example I'm updating a single column (c2). If I needed to update multiple columns in the table would I need to use the SELECT construct for
each column?

Yes, unfortunately. I would love to see some form of UPDATE FROM make it into SQLite, but none such exists at the moment.
--
Igor Tandetnik

Possibly INSERT OR REPLACE is useful when multiple columns need to be updated. I beiieve the following statement is equivilent to the given update

replace into t1 (c1, c2) select t1.c1, dtl1.c2 from t1 join t1 dtl1 on t1.c1 = dtl1.c1 - 1;

This requires however all columns of the table definition to be included in the column list and also the primary key. I assumed c1 is the primary key. _______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to