select * from 
(select * from table where m between month and month1)
where not((m=month and d<date) or (m=month1 and d>date1))

解决方案 »

  1.   

    select * from 
    (select * from table where m between month and month1)
    where not((m=month and d<date) or (m=month1 and d>date1))
      

  2.   


    (select * from table where m between month and month1)
    where not((m=month and d<date) or (m=month1 and d>date1))
      

  3.   

    可能我没说清楚。库里的内容是这样"2003-10-02 12:00:00"我手里的数据是这样time1:2003-9-02  time2:2003-10-12需要求time1到time2的所有数据。我直接用大于,小于来判断性能太差,改用DATEPART()只能单独判断年月日,不能跨月判断。谁有好的方法解决这个问题?