zoukankan      html  css  js  c++  java
  • COMPUTE&COMPUTE...BY...(转)

    /*******************计算(salary)整个结果集的汇总值*******************/
    select tech_title,salary
    from teacher_info
    where tech_title = '讲师'
    order by tech_title
    compute sum(salary)           

    /***********************按教师职称生成分组汇总*************************/
    Select tech_title,salary
    from teacher_info
    where tech_title='讲师' or tech_title='助教'
    order by tech_title
    compute sum(salary) by tech_title        

    注意: 1)DISTINCT关键字不能与聚合函数一起使用;
            2)COMPUTE子句中指定的列必须是 select 子句中已有的;
            3)因为 COMPUTE 子句产生非标准行,所以 COMPUTE子句不能与 select into 子句一起使用;
            4)COMPUTE BY 必须与order by 子句一起使用,且COMPUTE BY 中指定的列必须与 ORDER BY 子句中指定的列相同,或者为其子集,而且两者之间从左到右的顺序也必须相同;
            5)在COMPUTE 子句中,不能使用ntext、text或image数据类型。

  • 相关阅读:
    spring hibernate 调用存储过程
    Mybatis mapper配置
    流量红包算法
    带搜索的下拉框Chosen
    生成二维码
    Linux netlink机制
    OpenFlow Switch学习笔记(七)——Matching Fields
    Hierarchical Token Bucket
    OpenvSwitch架构
    Examining Open vSwitch Traffic Patterns
  • 原文地址:https://www.cnblogs.com/jshchg/p/2113325.html
Copyright © 2011-2022 走看看