On 18 Dec 2016, at 6:13pm, Keith Maxwell <keith.maxw...@gmail.com> wrote:

> I'm afraid I don't follow Simon. z is a column in t2. The sub-select
> uses z in an expression in its order by clause: abs(x - z). What do
> you mean by "your sub-select only refers to table t1"?

Then perhaps instead of

>  SELECT (SELECT y FROM t1 ORDER BY abs(x - z) LIMIT 1) FROM t2;

You want to change which one is the sub-select:

SELECT y FROM t1 ORDER BY abs(x - (SELECT z FROM t2)) LIMIT 1;

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to