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

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

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

        • <bdo id='eFzFR'></bdo><ul id='eFzFR'></ul>
        <tfoot id='eFzFR'></tfoot>

        ORA-00979 不是按表达式分组

        时间:2023-07-18
          <bdo id='EgSEz'></bdo><ul id='EgSEz'></ul>
        • <small id='EgSEz'></small><noframes id='EgSEz'>

            <tbody id='EgSEz'></tbody>

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

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

                  <tfoot id='EgSEz'></tfoot>
                  本文介绍了ORA-00979 不是按表达式分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我通过以下查询获得 ORA-00979:

                  I am getting ORA-00979 with the following query:

                  SELECT cr.review_sk, cr.cs_sk, cr.full_name,
                  tolist(to_char(cf.fact_date, 'mm/dd/yyyy')) "appt",
                  cs.cs_id, cr.tracking_number
                  from review cr, cs, fact cf
                  where cr.cs_sk = cs.cs_sk
                  and UPPER(cs.cs_id) like '%' || UPPER(i_cs_id) || '%'
                  and row_delete_date_time is null
                  and cr.review_sk = cf.review_wk (+)
                  and cr.fact_type_code (+) = 183050
                  GROUP BY cr.review_sk, cr.cs_sk, cf.fact_date, cr.tracking_number
                  ORDER BY cs.cs_id, cr.full_name;
                  

                  我找不到在同一查询中同时包含 GROUP BY 和 ORDER BY 子句的任何示例.我尝试一次从组中删除每个字段,但仍然遇到相同的错误.

                  I couldn't find any examples that had both GROUP BY and ORDER BY clauses in the same query. I tried removing each field from the group by one at a time, but am still getting the same error.

                  推荐答案

                  您必须将 SELECT 的所有列放在 GROUP BY 中或使用压缩函数结果为单个值(如 MINMAXSUM).

                  You must put all columns of the SELECT in the GROUP BY or use functions on them which compress the results to a single value (like MIN, MAX or SUM).

                  一个简单的例子来理解为什么会发生这种情况:想象一下你有一个这样的数据库:

                  A simple example to understand why this happens: Imagine you have a database like this:

                  FOO BAR
                  0   A
                  0   B
                  

                  然后你运行SELECT * FROM table GROUP BY foo.这意味着数据库必须返回一行作为结果的第一列 0 来满足 GROUP BY 但现在有两个 bar 值从中选择.您期望哪个结果 - AB?还是数据库应该返回不止一行,违反GROUP BY的约定?

                  and you run SELECT * FROM table GROUP BY foo. This means the database must return a single row as result with the first column 0 to fulfill the GROUP BY but there are now two values of bar to chose from. Which result would you expect - A or B? Or should the database return more than one row, violating the contract of GROUP BY?

                  这篇关于ORA-00979 不是按表达式分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:订购后如何限制 Oracle 查询返回的行数? 下一篇:如何在 SQL Server 中转义单引号?

                  相关文章

                  1. <tfoot id='eIm4s'></tfoot>

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

                        <bdo id='eIm4s'></bdo><ul id='eIm4s'></ul>

                    1. <small id='eIm4s'></small><noframes id='eIm4s'>

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