zoukankan      html  css  js  c++  java
  • oracle 一些简单操作

    merge into regist_person rp
    using dual
    on (rp.person_card = '10258968845')
    when matched then
      update
         set corp_id        = '2FC3BC773FE941CBAB8CEA31CC678595',
             GROUP_ID       = 'B51826A5B2494DD3BD3E5DBD4A089977',
             PERSON_NAME    = '李萍',
             NAME_PYJM      = 'LP',
             PERSON_SEX     = '女',
             PERSON_AGE     = '23',
             PERSON_ADDRESS = '北京市总部基地',
             PERSON_COUNTRY = '中国',
             PERSON_NATION  = '中国',
             PERSON_PHNO    = '12584785696',
             PERSON_TEL     = '10258968845',
             PERSON_EMAIL   = '39865858@qq.com',
             BIRTHDAY       = to_date('1984-7-27', 'yyyy-mm-dd HH24:mi:ss'),
             PERSON_POST    = '',
             PERSON_DEPT    = '',
             IS_MARRIAGE    = '否'
    when not matched then
      insert
        (PERSON_ID,
         CORP_ID,
         GROUP_ID,
         PERSON_NO,
         PERSON_NAME,
         NAME_PYJM,
         PERSON_SEX,
         PERSON_AGE,
         PERSON_CARD,
         PERSON_ADDRESS,
         PERSON_COUNTRY,
         PERSON_NATION,
         PERSON_PHNO,
         PERSON_TEL,
         PERSON_EMAIL,
         BIRTHDAY,
         PERSON_POST,
         PERSON_DEPT,
         IS_MARRIAGE)
      values
        ('84f26837-46e9-4cd0-bc7d-3631c5f748cc',
         '2FC3BC773FE941CBAB8CEA31CC678595',
         'B51826A5B2494DD3BD3E5DBD4A089977',
         '',
         '李萍',
         'LP',
         '女',
         '23',
         '411223197503453000',
         '北京市总部基地',
         '中国',
         '中国',
         '12584785696',
         '10258968845',
         '39865858@qq.com',
         to_date('1984-7-27', 'yyyy-mm-dd HH24:mi:ss'),
         '',
         '',
         '否')
    根据身份证判断是否存在此人,存在则修改,不存在则添加

    string sql = @"  select kindname,emr_icd10kind.id,(sum(bb)+sum(cc)+sum(dd)+sum(ee)) as  total, sum(aa) as zhiyu,sum(bb) as haozhuan,
                sum(cc) as weiyu,sum(dd) as siwang,
      sum(ee) as qita from emr_icd10kind
       left join
    (select icd10, decode(pa_leavehospital_nurcs,'治愈',count(pa_leavehospital_nurcs))aa,
    decode(pa_leavehospital_nurcs,'好转',count(pa_leavehospital_nurcs)) bb,
    decode(pa_leavehospital_nurcs,'未愈',count(pa_leavehospital_nurcs)) cc,
    decode(pa_leavehospital_nurcs,'死亡',count(pa_leavehospital_nurcs)) dd,
    decode(pa_leavehospital_nurcs,'其他',count(pa_leavehospital_nurcs)) ee
    from PATIENTS_Statistics where  Date_end >=to_date('" + dateBegin.ToString() + @"','yyyy-mm-dd hh24:mi:ss')
    and  Date_end <= to_date('" + dateEnd.ToString() + @"','yyyy-mm-dd hh24:mi:ss')
    group by icd10,pa_leavehospital_nurcs) nn
    on nn.icd10=emr_icd10kind.icdrange where emr_icd10kind.bigkindcode='D'
    group by emr_icd10kind.id,kindname order by emr_icd10kind.id";

    进行统计的一个示例

    select *  from(select rownum as rn,t.* from table t where rownum >0) where rn between 10 and 20

    oracle 取10-20条记录
  • 相关阅读:
    Python Excel 合并 去重
    前端 导出为Excel 数据源为table表格 table中的字段7-1变成了7月1号解决
    SpreadJS 基本信息
    Python 模拟向四面八方拖动
    Python 淘宝联盟-佣金设置 批量设置佣金和服务费
    Python 模拟鼠标滚轮 滚动页面
    评审恩仇录——我为什么愿意执行代码评审
    浅谈专有云MQ存储空间的清理机制
    三只松鼠:阿里云数据中台基座上的多渠道、多业态生长
    谈AK管理之基础篇
  • 原文地址:https://www.cnblogs.com/fish124423/p/2010220.html
Copyright © 2011-2022 走看看