このクエリはエラーを返します:
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 関数に関連しているはずです。どうすればこれを機能させることができますか?よろしくお願いします。