select*from table1 where ID in(1,2,3,4,...,1000)unionallselect*from table1 where ID in(1001,1002,...)