字段是datatime格式
//當日新加的積分
select SUM(integral) from 表名 where 時間字段 >= date(now()) and 時間字段 < DATE_ADD(date(now()),INTERVAL 1 DAY)
//當月新加積分
select SUM(integral) from 表名 where DATE_FORMAT(時間字段,'%Y-%m')=DATE_FORMAT(CURDATE(),'%Y-%m')
字段是時間戳格式
//當日新增人數
select count(id) from 表名 Where date_format(from_unixtime(時間字段),'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
//當月新增人數
select count(id) from 表名Where date_format(from_unixtime(時間字段),'%Y-%m') = date_format(now(),'%Y-%m')
僅供自己記錄使用,大神勿噴