錯誤碼:
SQL錯誤(1235):
This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
SQL錯誤(1235):
This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
指出是不能用的。
也就是
SELECT *
FROM TABLE
WHERE ID IN ( SELECT ID
FROM TABLE
LIMIT 10
)
FROM TABLE
WHERE ID IN ( SELECT ID
FROM TABLE
LIMIT 10
)
是不行的。
但,凡事也都有例外,
只要在子查詢再加一層就解決了!
SELECT *
FROM TABLE
WHERE ID IN ( SELECT a.ID
FROM (
SELECT ID
FROM TABLE LIMIT 10
) AS a
)
FROM TABLE
WHERE ID IN ( SELECT a.ID
FROM (
SELECT ID
FROM TABLE LIMIT 10
) AS a
)
就可以用啦!