不明白你所说的范围是怎样划分的,给你一个参考语句:Select * from TableName Where Autoid between 200 and 300UnionSelect * from TableName Where Autoid between 500 and 600UnionSelect * from TableName Where Autoid between 523 and 698UnionSelect * from TableName Where Autoid between 900 and 1200Order By Autoid祝你好运。
你用in语句只能得到等于那些值的记录而不是在范围内的数据,关键还是看你的要求,你也可以试试用下面的写法:Select * from TableName Where (Autoid between 200 and 300) or (Autoid between 500 and 600) or (...)
Select * from TableName Where (Autoid between 200 and 300) or (Autoid=500) or (Autoid=523) or (Autoid=600) or (Autoid=698) or (Autoid between 900 and 1200)
Select * from TableName Where Autoid in (select autoid from tablename where Autoid between 200 and 300 or Autoid=500 or Autoid=523 or Autoid=600 or Autoid=698 or Autoid between 900 and 1200)