MySQL View chart example

Source: Internet
Author: User

/* Get system Organizational structure
* Includes user name, user ID, store name, store ID, creation time ...
*/

CREATE VIEW Organizationtableview as select Id,storename,regdate from V9_qd_account;

/* Get CPZ installation data for the day (aggregated by user group)
* Includes user ID, CPZ value ...
*/
CREATE VIEW Todaycpztableview as select Storeid,storename,count (ID) as Total,sum (Tui_num) as Tui_num from V9_qd_dev where D Ays = Date_format (now (), '%y%m%d ') group by StoreID;

/* Get CPZ Installation data per day of the month (aggregated by day, user group)
* Includes date (days), user ID, CPZ value, Cpzapp value, repeat CPZ value ...
*/
CREATE VIEW Historycurrentmonthdayview as select Storeid,storename,count (ID) as Total,sum (Tui_num) as Tui_num,days from V9_qd_dev where days > Date_format (Now (), '%y%m ') group by Storeid,days;

/* Get monthly CPZ installation data (aggregated by month, user group)
* Includes date (days), user ID, CPZ value, Cpzapp value, repeat CPZ value ...
*/
CREATE VIEW Historymonthtableview as select Storeid,storename,count (ID) as Total,sum (Tui_num) as Tui_num, Date_format ( From_unixtime (installdate), '%y%m ') as months from V9_qd_dev Group by Storeid,months;

/* Get CPZ Installation data () based on the IMEI entered
* includes IMEI, account ID, store ID, installation time, repeat installation, number of apps installed, phone model
*/
CREATE VIEW Querycpzdatumbyimei as select Storeid,storename,verify,tui_num,sn,idfa,imei,devms,installdate from V9_qd_ Dev


Today
Date_format (now (), '%y%m%d ');

MySQL View chart example

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.