易截截图软件、单文件、免安装、纯绿色、仅160KB

关于group by的sql语句?

  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 表达式?

ORA-00979 not a GROUP BY expression

Cause: 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.


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


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

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


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

语句本身没有问题
试试用d


相关问答:

求SQL语句控制一列的值

哪位高手提供一个SQl语句,控制表中指定列的值必须是正数?
在程序里面判断不好吗??

你可以在建表的时候用check约束表中的该字段呀!
如:
create table tab_name(
name varchar2(20),
age numbe ......

求助一句SQL语句

数据类型:
Code char(6)
CreateTime datetime
Price float

数据如下:

Code      CreateTime          Price
031002 2008-10-17 15:00:15 ......

求sql触发器语句

users表
name  companyId  companyName


company表
companyId  companyName
1          a公司
2          b公司
......

问题:通过sql 枚举sqlserver 上建立的链接服务器列表

问题是这样的,
我的本地sqlserver 2000 服务器上,建立了多个远程链接服务器,
请问,我如何通过 sql语句,或者其他的方法枚举 这些链接服务器呢?(通过企业管理器我是知道的,
我要的是能通过编程枚举到 ......

求一sql语句。

表中是这样,
部门号    部门信息
  1        部门一
  2        部门二
  3        部门三
  4& ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号