日期函数的小问题

    技术2022-05-11  26

    获取表中前三天的记录。根据当前时间减三天.   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

     

     


    最新回复(0)