日期:2014-05-19  浏览次数:20518 次

日期函数的小问题
获取表中前三天的记录。根据当前时间减三天.    
 
select     *     from     business     where     productTime     =     getdate()-3        
 
查不到记录。由于表中的时间是默认时间是这种格式     2007-03-20     10:22:10.170    
后面这一段10:22:10.170    
与getdate()-3后面的这段时间不同的话。记录就出不来。。各位大虾是咋弄的?

------解决方案--------------------
select * from business where datediff(day,productTime,getdate())=3