SQL 语句按月份统计查询



// SQL 语句按月份统计查询
 select  year(createdate) 年,
 month(createdate) 月,
 count(1) from xx 
 where (userid in (select id from cms_admin where userid='392') or userid='392')
 group by year(createdate),
 month(createdate)
 order by year(createdate) desc,month(createdat) desc;

你可能感兴趣的:(sql,查询操作,sql)