On Sun, Jun 8, 2014 at 7:52 PM, Martin Hristov <tra...@gmail.com> wrote:

> Simple example :
>
> Working (correct result)
> select id from tbl where id in (select id from tbl)
>
> NOT working (incorrect result) :
> select id from tbl where id in ( ( select id from tbl) )
>

In the first query, SQLite looks for values of "id" that are in the
subquery.

In the second query, the subquery is evaluated as an expression.  That
means that only the first row of the result set is used.  And the
right-hand side of the IN clause is a list of expressions instead of a
subquery.

So the two queries mean different things.


-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to