// 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;