每周:

select count(*) as cnt,week(editdate) as weekflg from projects where year(editdate)=2007 group by weekflg

每月:

select count(*) as cnt,month(editdate) as monthflg from projects where year(editdate)=2007 group by monthflg

 

每天:

select count(*) as cnt from projects group by date(editdate)

Demo:

(thinkphp框架)

M('UserCourseSection')
->field('count(*) as nums,left(last_time, 10) as time')
->group('date(last_time)')
->order('last_time desc')
->select();

last_time 为数据库日期字段

相关文章:

  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
  • 2021-06-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-01-29
  • 2021-10-19
  • 2021-11-27
相关资源
相似解决方案