i’ve following select:
Select attribut1, dateattribut, attribut3,
attribut4, attribut15, town_CODE, count(*)
from (
select attribut1, dateattribut, attribut3, attribut4, attribut15, (CASE
WHEN TO_CHAR(dateattribut,'YYYY') = '2005' THEN
CASE town_CODE
WHEN '039' THEN '078' WHEN '050' THEN '093'
WHEN '091' THEN '008' WHEN '102' THEN '093'
ELSE town_CODE end
ELSE town_CODE end) as town_CODE
from towntable) GROUP BY attribut1, dateattribut,
attribut3, attribut4,
attribut15, town_CODE
having count(*) > 1;
when i execute this query on our server it work fine. but on the server of my customer i get the oracle error ORA-00979: not a GROUP BY expression.
As far i found out that im having problems with the Case’s and with the alias.
with out this it works.
any suggestions?
*what i’m trying to do with this statement is to get all double entry’s. with the inner query i change all old codes to the new one, and then i want to group them to see if they exists multiply times.
Some customers did used old codes and now its possible that they have the same town 2 times.
edit
SELECT * FROM product_component_version
and i get on both:
Product Version Status
NLSRTL 10.2.0.4.0 Production
Oracle Database 10g Enterprise Edition 10.2.0.4.0 64bi
PL/SQL 10.2.0.4.0 Production
TNS for 64-bit Windows: 10.2.0.4.0 Production
edit2
my test showed me that he doesn’t like calling with the alias.
is there a setting, that alias are not recognized?
My solution is to use an View.
Inner Select as View and then the outer select as normal, and it works fine.
i found out that he doesn’t like town_CODE in the outer select.