A
A
Art. Ku.2015-10-14 18:23:30
SQL
Art. Ku., 2015-10-14 18:23:30

Why doesn't LIMIT work in a nested query [WHERE a IN ( SELECT a FROM b LIMIT 1 )]?

Why does it not work with LIMIT (gives out emptiness), but does it work without LIMIT?

SELECT *  FROM b WHERE a IN ( SELECT а FROM b LIMIT 1  )

Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
maximw, 2015-10-14
@kukaew

Limit in subqueries is not supported.
MySQL does not support LIMIT in subqueries for ce...

SELECT * FROM t1
WHERE s1 IN (SELECT s2 FROM t2 ORDER BY s1 LIMIT 1);
ERROR 1235 (42000): This version of MySQL doesn't yet support
 'LIMIT & IN/ALL/ANY/SOME subquery'

A
Artur Polozov, 2015-10-14
@Noxy

Perhaps you are not getting an error?
ERROR 1235 (42000): This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question