mysql月统计日统计周统计

select sum(money) money from  dingdong.detailed

where  DATE_FORMAT(FROM_UNIXTIME( time, '%Y%m%d' ),'%Y')=DATE_FORMAT(now(),'%Y')

select sum(money) count from  dingdong.detailed

where  DATE_FORMAT(FROM_UNIXTIME( time, '%Y%m%d' ),'%Y%u')=DATE_FORMAT(now(),'%Y%u')

select sum(money) money from  dingdong.detailed

where  DATE_FORMAT(FROM_UNIXTIME( time, '%Y%m%d' ),'%Y%m%d')=DATE_FORMAT(now(),'%Y%m%d')

你可能感兴趣的:(mysql月统计日统计周统计)