tsql
tsql copied to clipboard
MySQL does not allow `LIMIT` with `IN/ALL/ANY/SOME(query)`
trafficstars
This is invalid in MySQL,
SELECT 1 IN (
SELECT 1 LIMIT 1
);
It is valid in PostgreSQL and SQLite.
However, MySQL supports,
SELECT 1 IN (
SELECT (SELECT 1 LIMIT 1)
);
So, if we have a LIMIT clause, just... wrap it inside another query