根據十二月進行資料統計合計
最後一行合計,最右一行合計
select
*, sum(
t.onemonth + t.twomonth + t.threemonth + t.fourmonth + t.fivemonth + t.sixmonth + t.sevenmonth + t.eightmonth + t.ninemonth + t.tenmonth + elevenmonth + twelvemonth
) total
from
(select
iec.channel_type as channelname,
sum( case month ( 月份 ) when '1' then 1 else 0 end ) as onemonth,
sum( case month ( 月份 ) when '2' then 1 else 0 end ) as twomonth,
sum( case month ( 月份 ) when '3' then 1 else 0 end ) as threemonth,
sum( case month ( 月份 ) when '4' then 1 else 0 end ) as fourmonth,
sum( case month ( 月份 ) when '5' then 1 else 0 end ) as fivemonth,
sum( case month ( 月份 ) when '6' then 1 else 0 end ) as sixmonth,
sum( case month ( 月份 ) when '7' then 1 else 0 end ) as sevenmonth,
sum( case month ( 月份 ) when '8' then 1 else 0 end ) as eightmonth,
sum( case month ( 月份 ) when '9' then 1 else 0 end ) as ninemonth,
sum( case month ( 月份 ) when '10' then 1 else 0 end ) as tenmonth,
sum( case month ( 月份 ) when '11' then 1 else 0 end ) as elevenmonth,
sum( case month ( 月份 ) when '12' then 1 else 0 end ) as twelvemonth
from
表名where
year ( 月份 ) = 2020
group by
iec.channel_type
union all
select
'合計' as channelname,
sum( case month ( 月份 ) when '1' then 1 else 0 end ) as onemonth,
sum( case month ( 月份 ) when '2' then 1 else 0 end ) as twomonth,
sum( case month ( 月份 ) when '3' then 1 else 0 end ) as threemonth,
sum( case month ( 月份 ) when '4' then 1 else 0 end ) as fourmonth,
sum( case month ( 月份 ) when '5' then 1 else 0 end ) as fivemonth,
sum( case month ( 月份 ) when '6' then 1 else 0 end ) as sixmonth,
sum( case month ( 月份 ) when '7' then 1 else 0 end ) as sevenmonth,
sum( case month ( 月份 ) when '8' then 1 else 0 end ) as eightmonth,
sum( case month ( 月份 ) when '9' then 1 else 0 end ) as ninemonth,
sum( case month ( 月份 ) when '10' then 1 else 0 end ) as tenmonth,
sum( case month ( 月份 ) when '11' then 1 else 0 end ) as elevenmonth,
sum( case month ( 月份 ) when '12' then 1 else 0 end ) as twelvemonth
from
表名where
year ( 月份 ) = 2020
) t
group by
字段
十二月,你好
歲月靜好,總會是有人在為你負重前行。雙鬢的白髮,眼角的皺紋無聲的告白著一切,你必須長大了!你必須得依靠自己的力量養活自己了!你也必須該讓父母享享福了!昨天去聽了艾力老師的巡講,有一處被戳中痛點。艾力老師講,學會與優秀的人合作 仔細想想,身邊真的不乏優秀的人。可是自己卻總喜歡踽踽獨行,很少去真正的去交...
十二月英語
前言 2017 年的最後乙個月份,我的英語收穫了什麼呢?哈哈,我收穫了責任心,恆心,凝聚力。而這些大部分來自於我的團隊。很榮幸再次擔當 13期英語組長之一,感謝小波的信任,也感謝組員的信任,英語之路還很長,我願意和大家一起慢慢走下去,知道迎接勝利的曙光!這個月,由於耳機壞了一陣子,所以零散時間利用的...
十二月寒冬
題記 你不會再聽我細數故事,我不會再深情望你。既然曾經相惜,今日但求不再互相折磨,走好。十二月,武漢的濕冷讓人無比的清醒。而我早已經埋在空調裡面了。但是這空調好像根本不讓人覺得暖,就算是有空調,也找不到一點暖心的感覺。總覺得周圍好冷,就算是走在陽光下面,也覺得有點難以忍受。尤其是陽光,最是可恨。時間...