Hey, I have to use IN condition in my MySQL statement with a large set of ids.
Example
SELECT * FROM users WHERE id IN (1,2,3,4...100000)
Is there a limit if items the IN statement can have?
From my experience the maximum values is 1000 values in clause IN ('1',....,'1000') , I have 1300 value in my excel sheet,I put them all into IN ,MySQL return only 1000 .
The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be nonnegative integer constants (except when using prepared statements).
The LIMIT clause is used in the SELECT statement to constrain the number of rows in a result set. The LIMIT clause accepts one or two arguments. The values of both arguments must be zero or positive integer constants.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With