On 12/8/2014 8:20 PM, Keith Medcalf wrote:
update temp_table set id=(select id from some_table where c=42), operation='UPDATE' where exists (select 1 from some_table s where s.a=temp_table.a and s.b=temp_table.b and s.c=42); is the proper way of phrasing of a correlated subquery ...
Now the problem is that (select id from some_table where c=42) takes an id from some row of some_table - not necessarily the row with matching a and b.
Without some form of UPDATE...FROM (supported by some SQL engines, but not SQLite), I can't think of a way to avoid repeating the whole three-conjuncts condition twice - once in SET id=, and again in WHERE.
-- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users