标签:
/*获取系统组织结构
*包括用户名称、用户ID、所属店面名称、所属店面ID、创建时间...
*/
CREATE VIEW organizationTableView as select id,storename,regdate from v9_qd_account;
/*获取当天的Cpz安装数据(按用户分组汇总)
*包括用户ID、Cpz汇总值...
*/
CREATE VIEW TodayCpzTableView as select storeid,storename,count(id)as total,sum(tui_num)as tui_num from v9_qd_dev where days = DATE_FORMAT(NOW(),‘%Y%m%d‘) group by storeid;
/*获取当月每天的Cpz安装数据(按天、用户分组汇总)
*包括日期(天)、用户ID、Cpz汇总值、CpzApp汇总值、重复Cpz汇总值...
*/
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;
/*获取每月的Cpz安装数据(按月、用户分组汇总)
*包括日期(天)、用户ID、Cpz汇总值、CpzApp汇总值、重复Cpz汇总值...
*/
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;
/*根据输入的IMEI获取Cpz安装数据()
*包括IMEI、账户ID、店面ID、安装时间、是否重复安装、安装app个数、手机型号
*/
CREATE VIEW QueryCpzDatumByIMEI as select storeid,storename,verify,tui_num,sn,idfa,imei,devms,installdate from v9_qd_dev;
//今天
DATE_FORMAT(NOW(),‘%Y%m%d‘);
标签:
原文地址:http://www.cnblogs.com/mr-amazing/p/4613338.html