How to compare only date part when delivery date is today

后端 未结 5 595
既然无缘
既然无缘 2021-02-05 08:59

I\'m trying to create a report that gets records from a SQL Server database where the delivery date is today.

I\'ve tried

select * from (tablename)
where         


        
5条回答
  •  被撕碎了的回忆
    2021-02-05 09:33

    You can try a query like below

    select * from (tablename)
    where CAST(delivery_date as date) = CAST(getdate() as date)
    

    Also if all delivery dates have time part like 00:00:00.000 for sure then

    select * from (tablename)
    where delivery_date = CAST(getdate() as date) 
    

    would work as good.

提交回复
热议问题