日期:2014-05-18 浏览次数:20652 次
select top 10 f_key,f_CreateTime from temp where f_key in (6345704424639041473, 6345704424875041563, 6345704425098441787, 6345704425148441832, 6345704425214041877) and (f_closetime >='2011-11-1' and f_closetime <='2011-11-30') and not (f_CreateTime >= '2011-11-16 00:00:00' and f_CreateTime <= '2011-11-16 23:59:59')
------解决方案--------------------
and f_CreateTime not between '2011-11-16 00:00:00' and '2011-11-16 23:59:59'
------解决方案--------------------
或者这样拆开
select top 10 f_key,f_CreateTime from temp where f_key in (6345704424639041473, 6345704424875041563, 6345704425098441787, 6345704425148441832, 6345704425214041877) and ((f_closetime >='2011-11-1' and f_closetime <'2011-11-16 00:00:00') or (f_CreateTime > '2011-11-16 23:59:59' and f_closetime <='2011-11-30') )
------解决方案--------------------
and f_CreateTime <='2011-11-16 00:00:00' and f_CreateTime >='2011-11-16 23:59:59'
------解决方案--------------------
(f_CreateTime>='2011-11-1 00:00:00' and f_CreateTime <='2011-11-16 00:00:00') or (f_CreateTime >='2011-11-16 23:59:59' and f_closetime <='2011-11-30 00:00:00' )