How to calculate the period-over-period ratio of an SQL statement! This month's resume count minus () last month's resume [this month's resume count]-[last month's resume count] = [month-on-month ratio] () how to write SQL statements? SELECTDATE_FORMAT (m_adddate, '% M') & nbsp; as & nbsp; month, count (m_id) & nbsp; how to calculate the period-over-period ratio of an SQL statement! The number of resumes in this month minus the number of resumes in the previous month ()
[Number of resumes this month]-[number of resumes in the previous month] = [number of resumes in the previous month ]()
How to write SQL statements?
SELECTDATE_FORMAT (m_adddate, '% M') as month, count (m_id) as zong, DATE_FORMAT (m_adddate,' % Y') as year from job_myreceive where DATE_FORMAT (m_adddate, '% Y') = 2011 group by DATE_FORMAT (m_adddate,' % M'); shared:
------ Solution --------------------
Well, you can write it clearly.
SELECT DATE_FORMAT (a. m_adddate, '% Y % M') as Ym, count (*) as 'month ',
(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 last month
FROM job_myreceive a group by 1
Ym last month
201012 6 0
201101 2 6
201105 1 0
201107 2 0
201112 1 0
201305 1 0