with adod_dict do
    begin
     close;
     commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode';
     parameters[0].DataType:=ftstring;
     parameters[0].Value:=trim(cbtjnd.Text);
     open;
    end;以上是delphi中的语句,运行时,老是报ora-00979 不是 group by 表达式?

解决方案 »

  1.   

    ORA-00979 not a GROUP BY expressionCause: The GROUP BY clause does not contain all the expressions in the SELECT clause. SELECT expressions that are not included in a group function, such as AVG, COUNT, MAX, MIN, SUM, STDDEV, or VARIANCE, must be listed in the GROUP BY clause.Action: Include in the GROUP BY clause all SELECT expressions that are not group function arguments.
      

  2.   

    若是改为select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd‘2004’group by bgqxcode 在 sql plus 中能正常运行
      

  3.   

    "带有 group by 子句的查询中的 select 字段列表中,除了包含在 group by 中的字段,其他字段都要求作为 group function (比如 AVG, COUNT, MAX, MIN, SUM )的参数出现,你的子查询违作为主查询的一个字段违反了这个规则了。"
      

  4.   

    若是改为select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd='2004' group by bgqxcode 在 sql plus 中能正常运行 
      

  5.   

    bobo_916 能帮我改下这条SQL语句吗?谢谢
      

  6.   

    语句本身没有问题
    试试用delphi自带的sql monitor查下实际是怎么执行的
      

  7.   

    http://topic.csdn.net/u/20080428/16/8347d35e-7572-40e7-a8e4-e3704fa853aa.html