Data analysis drawing, querying data using native SQL

Source: Internet
Author: User

1. Using Tools

https://www.hcharts.cn/

http://echarts.baidu.com/

2, sub-table query
ID creation time Content processor 1 2017-02-01 11:11 1 2 2017 -03-01 11:11 11 3 2017-04-01 11:11 2 4 2017-05 -01 11:11 1 5 2017-02-02 11:11 1 1.                            The idea processor list = Select processes the From-TB for processor in processor list: v = select * from TB where processor = Processor Group by creation Time (2017-02) 2.                                                                        Idea # Number of orders processed per month SELECT * from TB GROUP by creation time (%Y-%M)                            Select creation Time (%Y-%M), (select count (ID) from TB as T2 where processor =1 and t2.ctime = t1.ctime), (select COUNT (ID) From TB as T2 where processor =2 and t2.ctime = t1.cTime), from-TB as T1 group by Creation (%Y-%M) month id=1 id=                        2 2017-02 2) 2017-03 0 2017-04 0 2017-05 1

def trouble_json_report (Request):    reponse = [] from    django.db import connection,connections    userlist = UserInfo.objects.all () for    row in userlist:        cursor = connection.cursor ()        Cursor.execute (        "" "Select Unix_timestamp (Date_format (CTime, "%%y-%%m-01")) *1000, COUNT (ID) from repository_trouble WHERE processer_id=%s GROUP by Date_format (CTime, "%%y-%%m")        "" ", [Row.nid])        result = Cursor.fetchall ()        temp = {            ' name ': Row.username,            ' data ': Result        }        reponse.append (temp)    import JSON    return HttpResponse ( Json.dumps (reponse))

  

{% extends ' backdemo.html '%} {% block title%} article{% endblock%}{% block css%} <style> </style>{% endblock%}{% block modal% }{% endblock%}{% block content%} <ol class= "breadcrumb" > <li><a href= "#" > Security Management </a></ li> <li class= "active" > Data analysis </li> </ol>

  

Data analysis drawing, querying data using native SQL

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.