易截截图软件、单文件、免安装、纯绿色、仅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两列合并显示?

查询结果集:
ps  online  totle
a    0      10
b    1      11
c    5        8
想显示成这样 ......

怎么连接安装时没有使用默认实例的SQL Server2000?

A机器(XP)(10.10.6.65)完整的计算机名是: DZD服务器

我装了一个个人版: SQLServer2000,创建了一个实例名为:MYINSTANCE

装了:dotNetFx35setup.exe

并打好了SP4补丁:SQL2000-KB884525-SP ......

ORACLE sql语句的问题

  现在有表A(barcode varchar2,length number),B(barcode varchar2,serial number)其中barcode关联A:B为1:n

有如下sql语句
insert into a values('b1',10)
insert into a values( ......

求sql触发器语句

users表
name  companyId  companyName


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

两张字段相同表,求SQL语句,谢谢大家

有两张字段相同的表A,B。字段为SN, Name, Operator, Result, Remark
A表中字段SN唯一,B表中字段SN不唯一,有很多条
如何用一条select语句
把符合SN=’abc’的记录从A,B表中筛选出来?



SQL co ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号