mysql 視圖樣本

來源:互聯網
上載者:User

標籤:

/*擷取系統組織圖
 *包括使用者名稱稱、使用者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‘);

mysql 視圖樣本

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.