Excel中怎么實(shí)現(xiàn)動(dòng)態(tài)行轉(zhuǎn)列-創(chuàng)新互聯(lián)

這篇文章將為大家詳細(xì)講解有關(guān)Excel中怎么實(shí)現(xiàn)動(dòng)態(tài)行轉(zhuǎn)列,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個(gè)參考,希望大家閱讀完這篇文章后對相關(guān)知識有一定的了解。

創(chuàng)新互聯(lián)堅(jiān)信:善待客戶,將會(huì)成為終身客戶。我們能堅(jiān)持多年,是因?yàn)槲覀円恢笨芍档眯刨嚒N覀儚牟缓鲇瞥踉L客戶,我們用心做好本職工作,不忘初心,方得始終。十多年網(wǎng)站建設(shè)經(jīng)驗(yàn)創(chuàng)新互聯(lián)是成都老牌網(wǎng)站營銷服務(wù)商,為您提供成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、H5場景定制、網(wǎng)站制作、高端網(wǎng)站設(shè)計(jì)、小程序開發(fā)服務(wù),給眾多知名企業(yè)提供過好品質(zhì)的建站服務(wù)。


查詢的SQL如下
<ol start="1" class="dp-sql" white-space:normal;">

  • select type,ts,cn,as DECIMAL) val from (  

  • select    

  • starttime,'發(fā)布' type,base.ts,base.cn,ifnull(t1.val,0) val  

  • from   

  • (  

  •     select    

  •         t1.*,  

  •         startdate+ interval id-1 hour starttime,  

  •         startdate+ interval id hour endtime,  

  •         date_format(startdate+ interval id-1 hour,'%m%d%H') ts,  

  •         vars.*  

  •     from nums ,(select ${starttime} startdate,${endtime} enddate) vars,  

  •     (  

  •         select 'mvbox_user.user_otherinfo' busidatatype,1 type,'內(nèi)容審核.個(gè)人資料' cn union all   

  •         select 'mvbox_user.user_baseinfo',1,'內(nèi)容審核.個(gè)人喜好' union all   

  •         select 'photo_album',1,'內(nèi)容審核.相冊信息' union all   

  •         select 'photo_list',1,'內(nèi)容審核.圖片信息' union all   

  •         select 'music_original',1,'內(nèi)容審核.原唱信息' union all   

  •         select 'music_cover',1,'內(nèi)容審核.翻唱信息' union all   

  •         select 'music_accompany',1,'內(nèi)容審核.伴奏信息' union all   

  •         select 'music_album',1,'內(nèi)容審核.音樂專輯' union all   

  •         select 'music_video',1,'內(nèi)容審核.視頻信息' union all   

  •         select 'blog_album',1,'內(nèi)容審核.日志與文章' union all   

  •         select 'mvbox_user.user_baseinfo',2,'內(nèi)容審核.MVBOX頭像審核'  

  •     ) t1  

  •     where id<= TIMESTAMPDIFF(hour,startdate,enddate)  

  •     order by busidatatype,type,starttime  

  • ) base join   

  • (  

  •     select busidatatype,type,date_format(createtime,'%m%d%H') ts,from  audit_obj_detail   

  •     where createtime>=${starttime} and createtime<${endtime}   

  •     and busitype = 'mvbox'  

  •     group by busidatatype,type,date_format(createtime,'%m%d%H')  

  • ) t1 on (base.busidatatype=t1.busidatatype and base.type=t1.type and base.ts=t1.ts)  

  • group by base.busidatatype,base.type,base.ts,base.cn    

  • union all  

  • select    

  • starttime, '審核' type,base.ts,base.cn,ifnull(t1.val,0) val  

  • from   

  • (  

  •     select    

  •         t1.*,  

  •         startdate+ interval id-1 hour starttime,  

  •         startdate+ interval id hour endtime,  

  •          date_format(startdate+ interval id-1 hour,'%m%d%H') ts,  

  •         vars.*  

  •     from nums ,(select ${starttime} startdate,${endtime} enddate) vars,  

  •     (  

  •         select 'mvbox_user.user_otherinfo' busidatatype,1 type,'內(nèi)容審核.個(gè)人資料' cn union all   

  •         select 'mvbox_user.user_baseinfo',1,'內(nèi)容審核.個(gè)人喜好' union all   

  •         select 'photo_album',1,'內(nèi)容審核.相冊信息' union all   

  •         select 'photo_list',1,'內(nèi)容審核.圖片信息' union all   

  •         select 'music_original',1,'內(nèi)容審核.原唱信息' union all   

  •         select 'music_cover',1,'內(nèi)容審核.翻唱信息' union all   

  •         select 'music_accompany',1,'內(nèi)容審核.伴奏信息' union all   

  •         select 'music_album',1,'內(nèi)容審核.音樂專輯' union all   

  •         select 'music_video',1,'內(nèi)容審核.視頻信息' union all   

  •         select 'blog_album',1,'內(nèi)容審核.日志與文章' union all   

  •         select 'mvbox_user.user_baseinfo',2,'內(nèi)容審核.MVBOX頭像審核'  

  •     ) t1  

  •     where id<= TIMESTAMPDIFF(hour,startdate,enddate)  

  •     order by busidatatype,type,starttime  

  • ) base join   

  • (  

  •     select busidatatype,type,date_format(AuditTime,'%m%d%H') ts,from  audit_obj_detail   

  •     where AuditTime>=${starttime} and AuditTime<${endtime}   

  •     and busitype = 'mvbox'  

  •     group by busidatatype,type,date_format(AuditTime,'%m%d%H')  

  • ) t1 on (base.busidatatype=t1.busidatatype and base.type=t1.type and base.ts=t1.ts)  

  • group by base.busidatatype,base.type,base.ts,base.cn   

  • ) t1 ;  


  • 由于這個(gè)SQL已然比較復(fù)雜,再加動(dòng)態(tài)行轉(zhuǎn)列,可讀性幾乎就沒有了.


  • 這個(gè)SQL查詢的結(jié)果大致如下。


  • Excel中怎么實(shí)現(xiàn)動(dòng)態(tài)行轉(zhuǎn)列
  • 其中type可能是發(fā)布或者審核.


  • ts 表示月 日 和小時(shí)


  • cn表示模塊類型


  • val表示數(shù)量.



  • 將這個(gè)結(jié)果導(dǎo)入至Excel


  • 選擇插入,數(shù)據(jù)透視表


  • Excel中怎么實(shí)現(xiàn)動(dòng)態(tài)行轉(zhuǎn)列

  • 然后將ts 設(shè)置為列標(biāo)簽,這樣 ts 就由行變成列顯示


  • cn和type作為行標(biāo)簽.


  • val作為顯示數(shù)值


  • Excel中怎么實(shí)現(xiàn)動(dòng)態(tài)行轉(zhuǎn)列

  • 然后選擇視圖->凍結(jié)窗格->凍結(jié)首列  方便觀看數(shù)據(jù)



  • 可以看到如下結(jié)果


  • Excel中怎么實(shí)現(xiàn)動(dòng)態(tài)行轉(zhuǎn)列

  • 完全符合動(dòng)態(tài)行轉(zhuǎn)列的需求,并且可以排序和篩選.太強(qiáng)大了.

關(guān)于Excel中怎么實(shí)現(xiàn)動(dòng)態(tài)行轉(zhuǎn)列就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。

網(wǎng)頁標(biāo)題:Excel中怎么實(shí)現(xiàn)動(dòng)態(tài)行轉(zhuǎn)列-創(chuàng)新互聯(lián)
網(wǎng)頁路徑:http://bm7419.com/article24/igije.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、關(guān)鍵詞優(yōu)化、網(wǎng)站營銷、網(wǎng)站制作、Google營銷型網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司