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

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

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

    JUST DO IT ~

    我只想當個程序員

    oracle 多條 變 一條 group count(*) 匯集成 1條


    oracle
       

    insert  table1
    select  name ,count(*)
    from ...
    group by  type


    select            ,case type1  ==  value1  , case type2 == value2  , case  type3 = value3  .........這里也要寫死的
    from table2 , table1

    導入到臨時表   1:N 然后拼接出一張表 寫1次固定代碼

    還沒想到更好的...................????????






    其他方式

    select     ......
    from a
    ( select  * ,count   from  ...   where   type1  ) t1
    ( select  * ,count   from  ...   where   type2  ) t2
    .
    .
    .
    .

    有幾種就要寫幾種.... 但是速度如何呢? 要發動N次的 index count(*)   寫2次固定代碼



    1-1-1-N
    可能因為 不是3,6 整天記錄都不輸出  問題是怎么解決 .



      
    select
           a.seatid_      "xwh" ,      
    --席位
           b.exchgcode_  "jys"    , --交易所
           b.holderacc_ "khh",        --客戶號
           c.password_ "khmm" ,   -- 密碼
           count(*)     "num"  ,  
           
    case  
                
    when  count(*= 0   then   'N'    --不讀回報 沒有未完成的委托
                else    'Y'                        -- 有未完成的委托 
           end    "qbh"                -- 取回報
          from acc_seat a, acc_holder2seat b , acc_holder c ,dl_entrust  d
         
    where a.exchgcode_ =  v_exchgcode
           
    and a.seatid_ =  v_seatid
           
    and a.exchgcode_ = b.exchgcode_
           
    and a.seatid_ = b.seatid_
           
    and b.exchgcode_ =c.exchgcode_
           
    and b.holderacc_ =c.holderacc_ 
           
    and d.exchgcode_ = a.exchgcode_ 
           
    and d.seatid_ = a.seatid_ 
           
    and d.holderacc_  = b.holderacc_ 
           
    and d.entstatus_ not in (3,6)    
         
    group by        a.seatid_    ,      --席位
           b.exchgcode_      , --交易所
           b.holderacc_  ,        --客戶號
           c.password_ ;  -- 密碼 



      select
           a.seatid_      "xwh" ,      
    --席位
           b.exchgcode_  "jys"    , --交易所
           b.holderacc_ "khh",        --客戶號
           c.password_ "khmm" ,   -- 密碼
          nvl( (
           
    select  count(*
           
    from  dl_entrust  d
           
    where  1=1    and d.exchgcode_ = a.exchgcode_ 
           
    and d.seatid_ = a.seatid_ 
           
    and d.holderacc_  = b.holderacc_ 
           
    and d.entstatus_ not in (3,6)    
           ),
    0 )     "num"    

      
          
    from acc_seat a, acc_holder2seat b , acc_holder c  
         
    where a.exchgcode_ =  &v_exchgcode
           
    and a.seatid_ =  &v_seatid
           
    and a.exchgcode_ = b.exchgcode_
           
    and a.seatid_ = b.seatid_
           
    and b.exchgcode_ =c.exchgcode_
           
    and b.holderacc_ =c.holderacc_ 




    posted on 2008-09-08 08:03 小高 閱讀(682) 評論(0)  編輯  收藏 所屬分類: Oracle

    導航

    <2008年9月>
    31123456
    78910111213
    14151617181920
    21222324252627
    2829301234
    567891011

    統計

    常用鏈接

    留言簿(3)

    隨筆分類(352)

    收藏夾(19)

    關注的blog

    手冊

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 毛片视频免费观看| 亚洲男人的天堂www| 成人a毛片视频免费看| 亚洲精品无码久久一线| 性xxxxx免费视频播放| 色多多www视频在线观看免费| 国产亚洲精久久久久久无码| 久久久久久免费视频| 高清免费久久午夜精品| 亚洲综合久久1区2区3区| 日本人护士免费xxxx视频| 成人影片一区免费观看| 亚洲日韩国产欧美一区二区三区| 中文字幕亚洲综合久久菠萝蜜| 99久久精品日本一区二区免费| 成年大片免费视频播放一级 | 国产精一品亚洲二区在线播放| 一个人免费高清在线观看| 国产精品免费αv视频| 亚洲综合偷自成人网第页色| 亚洲中文字幕无码久久综合网| 欧亚精品一区三区免费| 日韩精品在线免费观看| 免费无码午夜福利片| 亚洲成在人线中文字幕| 亚洲成a人片在线观看无码专区| 永久黄网站色视频免费直播| 99久久国产免费中文无字幕| 一区二区三区免费视频网站| 亚洲熟妇丰满xxxxx| 亚洲日本在线看片| 亚洲福利精品一区二区三区| 成年女人毛片免费观看97| 久久精品中文字幕免费| 国产JIZZ中国JIZZ免费看| 苍井空亚洲精品AA片在线播放 | 亚洲国产AV一区二区三区四区| 91嫩草私人成人亚洲影院| 国产成人麻豆亚洲综合无码精品 | 24小时免费看片| 黄色片免费在线观看|