On 9-12-2014 02:31, Igor Tandetnik wrote:
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.
OK, thanks for the extra input...
I hope it's enough for the OP.
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.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users