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

>    CREATE TABLE t1(x INTEGER, y INTEGER);
>    INSERT INTO t1(x, y) VALUES(2, 1), (3, 2), (6, 4);
>    CREATE TABLE t2(z INTEGER);
>    INSERT INTO t2(z) VALUES(4);
>    SELECT (SELECT y FROM t1 ORDER BY abs(x - z) LIMIT 1) FROM t2;

I’m puzzled by your syntax.  Your sub-select refers only to to table t1.  That 
table has only columns x and y.  It has no access to values for z.

Now suppose, despite this, the sub-select returns some values to the outer 
SELECT.  This leaves you with the outer select:

SELECT (13, 3, 94) FROM t2

That doesn’t tell me what you’re trying to do.

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

Reply via email to