Re: [sqlite] updating records in table A from joined records in table B

2011-04-01 Thread Robert Poor
@Pavel: close. @David: that works. = DROP TABLE IF EXISTS `table_a`; CREATE TABLE `table_a` (`key` int(11), `value` float, `str` varchar(255)); DROP TABLE IF EXISTS `table_b`; CREATE TABLE `table_b` (`key` int(11), `value` float, `str` varchar(255)); INSERT INTO `t

Re: [sqlite] updating records in table A from joined records in table B

2011-04-01 Thread Pavel Ivanov
> ... that is to say, update table_a.value from table_b.value, but only > on rows where table_a.key = table_b.key update table_a set value = (select table_b.value from table_b where table_b.key = table_a.key) Pavel On Fri, Apr 1, 2011 at 8:42 PM, Robert Poor wrote: > I'd like to be able to up

Re: [sqlite] updating records in table A from joined records in table B

2011-04-01 Thread David Garfield
A bit redundant, but how about: CREATE TABLE table_a (akey integer, avalue float); CREATE TABLE table_b (bkey integer, bvalue float); INSERT INTO table_a (akey, avalue) VALUES (1, 1.0); INSERT INTO table_a (akey, avalue) VALUES (2, 2.0); INSERT INTO table_a (akey, avalue) VALUES (3, 3.0); IN

[sqlite] updating records in table A from joined records in table B

2011-04-01 Thread Robert Poor
I'd like to be able to update specific records in table A from joined records in table B. So for example: CREATE TABLE "table_a" ("key" integer, "value" float); CREATE TABLE "table_b" ("key" integer, "value" float); INSERT INTO "table_a" ("key", "value") VALUES (1, 1.0), (2, 2.0),(3, 3.0); I