【问题标题】:not able to run "group by" query in dbvisualizer 6.5无法在 dbvisualizer 6.5 中运行“分组依据”查询
【发布时间】:2012-04-05 10:20:19
【问题描述】:

我在dbvisualizer中执行下面的sql

Select column1,column2,column3 from table group by column3;

显示以下错误:

15:47:09 [SELECT - 0 行,0.000 秒] [错误代码:979,SQL 状态:42000] ORA-00979:不是 GROUP BY 表达式 ... 1 条语句执行,0 行受影响,执行/获取时间:0.000/0.000 秒 [0 成功,0 警告,1 错误]

但是当我查询时它会给出结果:

Select column1 from table group by column1;

查询中是否有任何语法错误或某些配置或支持问题。

【问题讨论】:

    标签: sql group-by dbvisualizer


    【解决方案1】:

    在group by statement 中,您应该指定与select 中相同的列(总和、计数等除外)

    所以你的查询

    Select column1,column2,column3 from table group by column3;
    

    应该是

    Select column1,column2,column3 from table group by column1,column2,column3;
    

    【讨论】:

      【解决方案2】:

      SELECT CLAUSE AND GROUP BY CLAUSE 列类似于 HUSBAND AND WIFE。您在 SELECT 中执行的聚合操作是它们的子项。我的意思是说您的 SELECT 和 GROUP BY CLAUSE 中的列数应该相等。这是一个拇指规则。

      【讨论】:

        猜你喜欢
        • 2010-12-28
        • 2023-01-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-12-19
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多