Home > Article > Backend Development > 一条SQL语句怎么求环比!这个月简历数减去上个月的(如图)
一条SQL语句如何求环比!这个月简历数减去上个月的(如图)
【这个月简历数】-【上个月的简历数】=【环比数】(如图)
sql语句如何写?
SELECT DATE_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');