How to query DATETIME field using only date in Microsoft SQL Server?

后端 未结 17 1987
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 06:31

I have a table TEST with a DATETIME field, like this:

ID NAME DATE
1 TESTING 2014-03-19 20:05:20.000
         


        
17条回答
  •  鱼传尺愫
    2020-12-02 06:55

    I am using MySQL 5.6 and there is a DATE function to extract only the date part from date time. So the simple solution to the question is -

     select * from test where DATE(date) = '2014-03-19';
    

    http://dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html

提交回复
热议问题