关于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
相关问答:
....接到一个小程序..工作原来大概是这样的...前台是WEB服务器.架构就是ASP+SQL..前台由ASP向SQL添加服务类别(表单).然后又后台程序读取表单..要实时读取..然后显示在服务器上面..从理论上面能行通不?如果可以..后台 ......
数据类型:
Code char(6)
CreateTime datetime
Price float
数据如下:
Code CreateTime Price
031002 2008-10-17 15:00:15 ......
小弟是个新手 现在有个问题一直不能解决
例如
procedure produce_proc
@p001 nvarchar(8000),
@p002 nvarchar(8000),
@p003 nvarchar(8000),
& ......
表中是这样,
部门号 部门信息
1 部门一
2 部门二
3 部门三
4& ......
各位大侠,我有一个xml文件
XML code:
<?xml version="1.0" encoding="GB2312"?>
<FileId fileid="86">
<ResultSet>
<row id="0">
......