How to select rows that have current day's timestamp?

后端 未结 9 1614
渐次进展
渐次进展 2020-11-28 21:14

I am trying to select only today\'s records from a database table.

Currently I use

SELECT * FROM `table` WHERE (`timestamp` > DATE_SUB(now(), INTE         


        
9条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 22:15

    On Visual Studio 2017, using the built-in database for development I had problems with the current given solution, I had to change the code to make it work because it threw the error that DATE() was not a built in function.

    Here is my solution:

    where CAST(TimeCalled AS DATE) = CAST(GETDATE() AS DATE)

提交回复
热议问题