where datepart(yy,time)=2001
and datepart(mm,time)=11
and datepart(dd,time) > 0 and datepart(dd,time) < 30
and datepart(hh,time) >0 and datepart(hh,time) < 24
and datepart(mm,time)=11
and datepart(dd,time) > 0 and datepart(dd,time) < 30
and datepart(hh,time) >0 and datepart(hh,time) < 24
可以先
(select * from table where time between 2001年11月 and 2001年12月 (具体自己写)
然后从a里取出剩下满足条件的记录
只是为了用户录入的方便,用户可以在界面上随意点取任意天,任意时
问题的关键时条件中应用了datepart极大的影响了查询速度
在sybase中好像不能使用select field from select field from table这样的语句