zoukankan      html  css  js  c++  java
  • 【SQL查询】查询列中使用条件逻辑_case when then end

    select x.范围, count(*)
      from (select t.ename,
                   case
                     when t.sal <= 1000 then
                      '0-1000'
                     when t.sal <= 2000 then
                      '1000-2000'
                     when t.sal <= 3000 then
                      '2000-3000'
                     when t.sal <= 4000 then
                      '3000-4000'
                     when t.sal <= 5000 then
                      '3000-4000'
                     ELSE
                      '太高'
                   END as 范围
              from emp t) x
     group by x.范围
     order by x.范围;

  • 相关阅读:
    UVA
    UVA
    母函数
    快速排序
    集合:set
    stringstream转换
    大学期间的任务
    Devc++贪吃蛇
    Vector容器
    广度优先遍历
  • 原文地址:https://www.cnblogs.com/zhuhaiying/p/7910050.html
Copyright © 2011-2022 走看看