A SQL statement how to find the chain! The number of resumes this month minus last month's (pictured)

Source: Internet
Author: User
How do you find a SQL statement for the chain? The number of resumes this month minus last month's ()

"Number of resumes in the month"-"resumes last month" = "Number of years" ()

How is the SQL statement written?
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 ');

Share to:


------Solution--------------------
Well, write it clearly.
SELECT date_format (a.m_adddate, '%y%m ') as Ym, COUNT (*) as ' month ',

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 month last month
201012 6
201101 2
201105 1
201107 2
201112 1
201305 1 0
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.