<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    簡(jiǎn)易代碼之家

      BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
      157 Posts :: 2 Stories :: 57 Comments :: 0 Trackbacks

    數(shù)據(jù)表結(jié)構(gòu)及數(shù)據(jù):


    要統(tǒng)計(jì)的報(bào)表格式:


    SQL語(yǔ)句:

    1.只統(tǒng)計(jì)最右邊的合計(jì)人數(shù):
    select t.addr,
          sum( case when(t.type='0') then 1 else 0 end ) as "甲流人數(shù)",
          sum( case when(t.type='1') then 1 else 0 end ) as "流感人數(shù)",
          sum( case when(t.type='2') then 1 else 0 end ) as "它病人數(shù)",
          count(*) as "合計(jì)人數(shù)"
    from test t
    group by t.addr;
    2.最右邊和下邊的合計(jì)都統(tǒng)計(jì):
    (select t.addr as "區(qū)域",
          sum( case when(t.type='0') then 1 else 0 end ) as "甲流人數(shù)",
          sum( case when(t.type='1') then 1 else 0 end ) as "流感人數(shù)",
          sum( case when(t.type='2') then 1 else 0 end ) as "它病戶(hù)數(shù)",
          count(*) as "合計(jì)人數(shù)"
    from test t
    group by t.addr)
    union
    (select null, sum( case when(t.type='0') then 1 else 0 end ),
          sum( case when(t.type='1') then 1 else 0 end ),
          sum( case when(t.type='2') then 1 else 0 end ),
          count(*)
    from test t);

     

    posted on 2009-11-13 15:12 Jakin.zhou 閱讀(472) 評(píng)論(0)  編輯  收藏

    只有注冊(cè)用戶(hù)登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 中文字幕亚洲码在线| 久久精品国产亚洲AV麻豆~| 亚洲精品福利视频| 久久免费国产精品一区二区| 激情97综合亚洲色婷婷五| 国产精品亚洲lv粉色| 免费无码AV片在线观看软件| 亚洲AV成人噜噜无码网站| 免费三级毛片电影片| 久久亚洲国产成人影院| 24小时免费直播在线观看| www亚洲精品久久久乳| 亚洲色图综合在线| 日韩精品无码免费专区午夜 | eeuss影院www天堂免费| 亚洲综合色视频在线观看| 99视频在线免费观看| 91在线亚洲精品专区| 在线a毛片免费视频观看| 在线观看亚洲电影| 亚洲三区在线观看无套内射| 国产精品区免费视频| 亚洲精品福利你懂| 免费观看国产小粉嫩喷水| 中文字幕在线观看免费| 国产成人A在线观看视频免费 | 亚洲视频小说图片| 免费人成在线视频| 一级做a毛片免费视频| 亚洲国产另类久久久精品黑人| 巨波霸乳在线永久免费视频 | 国产精品亚洲w码日韩中文| 久久免费国产精品一区二区| 亚洲五月综合网色九月色| 亚洲国产日韩在线观频| 99精品免费观看| 黄页免费视频播放在线播放| 亚洲国产高清在线| 国产免费av一区二区三区| 久久永久免费人妻精品| 国产精品亚洲专区无码WEB|