代码如下: select count(id) from table1 where DATE_FORMAT(datetime,'%Y-%m-%d' )=curdate() 也可以用datediff,不过如果数据量大的话好像不太好。