msql建立檢視筆錄
阿新 • • 發佈:2018-11-25
由於之前寫檢視都沒有記錄,這次客戶公司要求我寫三張檢視,卻發現自己忘了咋寫的!於是有去百度了下,分分鐘搞定了。但是,個人還是做個筆錄吧!以後不用去看別人的寫法咯。
#車輛會員查詢檢視 select * from v_vehicle_member_view drop view if EXISTS v_vehicle_member_view CREATE VIEW v_vehicle_member_view AS SELECT v.wcc_member_info MEMBER_ID, m.member_name MEMBER_NAME, m.phone_no PHONE_NO, DATE_FORMAT( m.registration_time, '%Y%m%d' ) REGISTRATION_DATE, DATE_FORMAT(m.registration_time, '%H%i%S') REGISTRATION_TIME, DATE_FORMAT(v.check_date, '%Y%m%d') CHECK_DATE, DATE_FORMAT(v.check_date, '%H%i%S') CHECK_TIME, DATE_FORMAT(v.purchase_date, '%Y%m%d') PURCHASE_DATE, v.owner_name OWNER_NAME, v.vin_code VIN_CODE FROM wcc_ch_vehicle v LEFT JOIN wcc_ch_member m ON v.wcc_member_info = m.id WHERE v.BINDING_STATUS = 1 AND (v. STATUS = 1 OR v. STATUS = 3) #車輛解綁檢視 select * from v_vehicle_unbind_view drop view if EXISTS v_vehicle_unbind_view CREATE VIEW v_vehicle_unbind_view AS SELECT v.wcc_member_info MEMBER_ID, v.vin_code VIN_CODE, DATE_FORMAT(v.BINDING_DATE, '%Y%m%d') BINGDING_DATE, DATE_FORMAT(v.BINDING_DATE, '%H%i%S') BINGDING_time FROM wcc_ch_vehicle v WHERE v.BINDING_STATUS = 2 select * from v_vehicle_unbind_view #服務點評資料 select * from v_service_review_view drop view if EXISTS v_service_review_view CREATE VIEW v_service_review_view AS SELECT sv.WCC_MEMBER_INFO member_ID, m.member_name KICKNAME, m.phone_no PHONE, sv.VIN_CODE VIN, sv.settle_no DOC_NO, d.dealer_no SOLD_TO, sv.satisfaction KF01, sv.environment KF02, sv.attitude KF03, sv.skills KF04, sv.message TXT, DATE_FORMAT(sv.getin_time, '%Y%m%d') DATE1, DATE_FORMAT(sv.getin_time, '%H%i%S') TIME1, DATE_FORMAT(sv.review_time, '%Y%m%d') DATE2, DATE_FORMAT(sv.review_time, '%H%i%S') TIME2, DATE_FORMAT( sv.insert_time, '%Y%m%d%H%i%S' ) CREATEDON FROM wcc_ch_service_review sv LEFT JOIN wcc_ch_member m ON sv.WCC_MEMBER_INFO = m.id LEFT JOIN wcc_ch_dealer d ON sv.DEALER = d.id
最後寄語,以上是博主本次文章的全部內容,如果大家覺得博主的文章還不錯,請點贊;如果您對博主其它伺服器大資料技術或者博主本人感興趣,請關注博主部落格,並且歡迎隨時跟博主溝通交流。