Select * From Table_Name Where MyColumnID NOT IN (1,2,3,4,5);
The above sql statement works perfectly fine, but when I try increasing the elements specifically pass 1000 (for my case) for e.g.
Select * From Table_Name Where MyColumnID NOT IN (1,2,3,4,5,...1000 and more);
It only returns a few rows or sometimes non at all. Any number of elements that is less than 1000 returns correctly for the NOT IN condition
Then, i tried using the IN condition as follows:
Select * From Table_Name Where MyColumnID IN (1,2,3,4,5,...9000 and more);
It works perfectly fine and as expected. if it works for the IN conditions, why would it not work for the NOT IN conditions?
I am really at a loss, could it be there is some variable I have missed somewhere?
Things that I have set or checked:
1) Max_allowed_packet = 1000000000;
2) ID contains no Null Values
3) Name of ID = 'StockID'