测试 not between

来源:互联网 发布:python语法基础知识 编辑:程序博客网 时间:2024/05/18 01:12

试试 not between

 

 

  1. ------------------------------------
  2. -- Author:Flystone 
  3. -- Version:V1.001  
  4. -- Date:2008-08-02 23:26:50
  5. ------------------------------------
  6. -- Test Data: @t
  7. declare @t table(id int)
  8. insert into @t 
  9. select top 20 id from sysobjects
  10. --Start
  11. Select * from @t
  12. --Result:
  13. /*
  14. id          
  15. ----------- 
  16. 1
  17. 2
  18. 3
  19. 4
  20. 6
  21. 8
  22. 9
  23. 10
  24. 11
  25. 12
  26. 14
  27. 19
  28. 20
  29. 21
  30. 22
  31. 23
  32. 24
  33. 95
  34. 96
  35. 979330
  36. (所影响的行数为 20 行)
  37. */
  38. select *
  39. from @t
  40. where id not between 5 and 20
  41. --Result:
  42. /*
  43. id          
  44. ----------- 
  45. 1
  46. 2
  47. 3
  48. 4
  49. 21
  50. 22
  51. 23
  52. 24
  53. 95
  54. 96
  55. 979330
  56. (所影响的行数为 11 行)
  57. */
  58. --End 
原创粉丝点击