时间:2021-07-01 10:21:17 帮助过:33人阅读
SELECT DATE_FORMAT(a.m_adddate,'%Y%m') as Ym, count(*) as `当月`,
(select count(*) from job_myreceive where
DATE_FORMAT(a.m_adddate,'%Y%m') = DATE_FORMAT(DATE_add(m_adddate,INTERVAL 1 MONTH),'%Y%m')
) as 上月
FROM job_myreceive a group by 1
Ym 当月 上月
201012 6 0
201101 2 6
201105 1 0
201107 2 0
201112 1 0
201305 1 0