某个场景下需要查询某一天的数据,例如2017/9/27这一天所有的数据量,有以下几个方法。
SELECT * FROM cms_book_statistics WHERE substring(Convert(char(10),update_time ,112),1,8)='20170927' SELECT * FROM cms_book_statistics WHERE update_time between '2017-09-27 00:00:00' and '2017-09-27 23:59:59' SELECT * FROM cms_book_statistics WHERE year(update_time ) = 2017 and month(update_time )= 09 and day(update_time ) = 27SELECT * FROM cms_book_statistics WHERE update_time > '2017-09-27' and update_time < '2017-09-28'SELECT * FROM cms_book_statistics WHERE ( datediff ( update_time , '2017-09-27' ) = 0 )