zoukankan      html  css  js  c++  java
  • oracle-记录

    同時查新多个条件的数量

    select sum(DECODE(trim(t.ASSESSED_RESULT),'维持',1,0)) maintainNum,
    sum(DECODE(trim(t.ASSESSED_RESULT),'晋升',1,0)) upNum,
    sum(DECODE(trim(t.ASSESSED_RESULT),'降级',1,0)) degradeNum,
    sum(DECODE(trim(t.ASSESSED_RESULT),'终止合同',1,0)) dissolutionNum
    from t_AssessResultInfo t, t02salesinfo_backup s
    where s.team_id=#{teamId} and t.sales_code=s.sales_code and s.channel_id=#{channelId} and s.year_month=#{month}
    and s.year_month=t.stat_month


    查询team_lvl最大的一条数据
    select * from (select distinct t.team_id as teamId,t.team_name as orgName,t.team_lvl as teamLvl 
    from t02salesinfo_backup s,t01teaminfo_backup t
    where s.sales_code=#{agentCode} and trim(s.channel_id)=#{channelId} and s.channel_id=t.channel_id
    and t.year_month=s.year_month and trim(t.stat)=1 and s.year_month=#{month} and s.sales_id=t.leader_id
    order by t.team_lvl desc)where rownum=1


    查询该表中的所有字段名和数据类型 注意:表名一定要大写!

    select A.COLUMN_NAME,A.DATA_TYPE from user_tab_columns A
    where TABLE_NAME='T01TEAMINFO'


    多条合并为一条
    原图:

    
    

    select sales_code, listagg(index_name, ',')
    within group(order by sales_code)indexName from t_SalesWageInfo
    group by sales_code;

    执行后:



  • 相关阅读:
    kill一个pthread_test.bin测试程序主线程、子线程退出kernel flow
    signal bit operation
    pthread
    信号发送处理流程
    sdcardfs
    node小贴士03
    node小贴士02
    node小贴士01
    siteserver cms 搜索功能
    语法的高亮显示
  • 原文地址:https://www.cnblogs.com/jjSmileEveryDay/p/9467345.html
Copyright © 2011-2022 走看看