/* 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