嘿,我必须在我的 MySQL 语句中使用 IN 条件和一大组 id。
例子
SELECT * FROM users WHERE id IN (1,2,3,4...100000)
如果 IN 语句中的项目可以有限制吗?
As far as I know in mysql, there is no limit for items in the IN statement.
IN
In oracle altough, there is a limit of 1000 items in the IN statement.
But more the items in IN, your query performance will slow down unless that column is indexed.
No there isn't, check the manual about the IN function:
The number of values in the IN list is only limited by the max_allowed_packet value.
1073741824 This is the limit given in Mysql docs