<small id='vrqWF'></small><noframes id='vrqWF'>

<legend id='vrqWF'><style id='vrqWF'><dir id='vrqWF'><q id='vrqWF'></q></dir></style></legend>

      <i id='vrqWF'><tr id='vrqWF'><dt id='vrqWF'><q id='vrqWF'><span id='vrqWF'><b id='vrqWF'><form id='vrqWF'><ins id='vrqWF'></ins><ul id='vrqWF'></ul><sub id='vrqWF'></sub></form><legend id='vrqWF'></legend><bdo id='vrqWF'><pre id='vrqWF'><center id='vrqWF'></center></pre></bdo></b><th id='vrqWF'></th></span></q></dt></tr></i><div id='vrqWF'><tfoot id='vrqWF'></tfoot><dl id='vrqWF'><fieldset id='vrqWF'></fieldset></dl></div>
        • <bdo id='vrqWF'></bdo><ul id='vrqWF'></ul>
        <tfoot id='vrqWF'></tfoot>

      1. Oracle:如何“分组"超过一个范围?

        Oracle: how to quot;group byquot; over a range?(Oracle:如何“分组超过一个范围?)
        <i id='zh0EY'><tr id='zh0EY'><dt id='zh0EY'><q id='zh0EY'><span id='zh0EY'><b id='zh0EY'><form id='zh0EY'><ins id='zh0EY'></ins><ul id='zh0EY'></ul><sub id='zh0EY'></sub></form><legend id='zh0EY'></legend><bdo id='zh0EY'><pre id='zh0EY'><center id='zh0EY'></center></pre></bdo></b><th id='zh0EY'></th></span></q></dt></tr></i><div id='zh0EY'><tfoot id='zh0EY'></tfoot><dl id='zh0EY'><fieldset id='zh0EY'></fieldset></dl></div>
        <legend id='zh0EY'><style id='zh0EY'><dir id='zh0EY'><q id='zh0EY'></q></dir></style></legend>
        • <bdo id='zh0EY'></bdo><ul id='zh0EY'></ul>

            <tfoot id='zh0EY'></tfoot>

                <small id='zh0EY'></small><noframes id='zh0EY'>

                    <tbody id='zh0EY'></tbody>

                • 本文介绍了Oracle:如何“分组"超过一个范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如果我有一张这样的桌子:

                  If I have a table like this:

                  pkey   age
                  ----   ---
                     1     8
                     2     5
                     3    12
                     4    12
                     5    22
                  

                  我可以分组"以获取每个年龄的计数.

                  I can "group by" to get a count of each age.

                  select age,count(*) n from tbl group by age;
                  age  n
                  ---  -
                    5  1
                    8  1
                   12  2
                   22  1
                  

                  我可以使用什么查询来按年龄范围分组?

                  What query can I use to group by age ranges?

                    age  n
                  -----  -
                   1-10  2
                  11-20  2
                  20+    1
                  

                  我在使用 10gR2,但我也对任何特定于 11g 的方法感兴趣.

                  I'm on 10gR2, but I'd be interested in any 11g-specific approaches as well.

                  推荐答案

                  SELECT CASE 
                           WHEN age <= 10 THEN '1-10' 
                           WHEN age <= 20 THEN '11-20' 
                           ELSE '21+' 
                         END AS age, 
                         COUNT(*) AS n
                  FROM age
                  GROUP BY CASE 
                             WHEN age <= 10 THEN '1-10' 
                             WHEN age <= 20 THEN '11-20' 
                             ELSE '21+' 
                           END
                  

                  这篇关于Oracle:如何“分组"超过一个范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  SQL query to group by day(按天分组的 SQL 查询)
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
                  <legend id='GOoxk'><style id='GOoxk'><dir id='GOoxk'><q id='GOoxk'></q></dir></style></legend>

                  1. <i id='GOoxk'><tr id='GOoxk'><dt id='GOoxk'><q id='GOoxk'><span id='GOoxk'><b id='GOoxk'><form id='GOoxk'><ins id='GOoxk'></ins><ul id='GOoxk'></ul><sub id='GOoxk'></sub></form><legend id='GOoxk'></legend><bdo id='GOoxk'><pre id='GOoxk'><center id='GOoxk'></center></pre></bdo></b><th id='GOoxk'></th></span></q></dt></tr></i><div id='GOoxk'><tfoot id='GOoxk'></tfoot><dl id='GOoxk'><fieldset id='GOoxk'></fieldset></dl></div>
                  2. <small id='GOoxk'></small><noframes id='GOoxk'>

                  3. <tfoot id='GOoxk'></tfoot>

                      • <bdo id='GOoxk'></bdo><ul id='GOoxk'></ul>

                            <tbody id='GOoxk'></tbody>