Consultation on a complicated query statement of mysql-MYSQL

Source: Internet
Author: User
Hi, the structure of my table is roughly like this Project number: expected transaction date status update date project status lead-12016-6-42016-3-1 Tracking lead-12016-6-52016- 3-2 lead-12016-7-52016-3-3 review lead-22016-3-52016-3-1 Tracking lead-22016-4-92016-3-3- 2. the result obtained in the review is that, from January 1, 00000 to January 1, 00000, 0100... mysqljson consultation

Hi, the structure of my table is roughly like this.
Project No. expected transaction date status update date Project status
Lead-1 2016-6-4 2016-3-1 tracking
Lead-1 under negotiation
Lead-1 under review
Lead-2 tracking
Lead-2 under review
The expected result is as follows:
From January 1, to January 1
Tracking 0 0 0 0 0
0 0 0 0 0 0 in negotiation
0 1 0 0 1 in review
Or you may want this result.
Number of month statuses
March tracking 0
Negotiation in March: 0
0 in March audit
April tracking 0
Negotiation in April: 0
Audit in April 1
May tracking 0
Negotiation in May: 0
0 in May audit
June tracking 0
Negotiation in June: 0
0 in June audit
July tracking 0
Negotiation in July: 0
Audit in April 1

That is, I only count the data of the latest status of each leadcode, and make statistics based on the estimated transaction date and project status of the data, the final expected result of the statistics, such as the second or third table
This is mainly used for returning to the front-end for drawing highchart .. I want to call the data in the form of "data. project status. month" or "data. MONTH. project status" after the query result is json. Is it possible to do this?
Thank you very much!

Or you can use other ideas to achieve the same content.

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.