【发布时间】:2011-02-10 12:03:35
【问题描述】:
此查询给出错误:
select ep,
case
when ob is null and b2b_ob is null then 'a'
when ob is not null or b2b_ob is not null then 'b'
else null
end as type,
sum(b2b_d + b2b_t - b2b_i) as sales
from table
where ...
group by ep, type
错误:ORA-00904:“TYPE”:无效标识符
当我使用group by ep 运行它时,错误消息变为:
ORA-00979: 不是 GROUP BY 表达式
如果我删除sum(b2b_d+b2b_t-b2b_i) as sales 和group by ... 行,整个查询工作正常,所以问题应该与SUM 和GROUP BY 函数有关。我怎样才能使这项工作?提前感谢您的帮助。
【问题讨论】:
标签: sql oracle ora-00904 ora-00979