0

I'm trying to write a subquery from table c,d as a column value while outer query is from table a, b. how can i rewrite the query to perform individual calculation for num0 column and den0 column. I'm getting this error. This is not a duplicate of a group function error

ORA-00937: not a single-group group function 00937. 00000 - "not a single-group group function"

I even tried select 1 from dual for the sake of simplicity which also resulted in the above error. I have tried to join all 4 tables a,b,c,d but since the data is huge, this is taking a lot of time to retrieve the result.

select
sum(k.tickets) num0, 1 den0, sum(k.tickets) val0,
(select count(*) from c, d where c.column = d.column) num3, 0 den3, 'SLA' tag3, 'total' num_tag3, 'total' den_tag3, 2 decimals3, 100 multiplier3,
1 num4, 1 den4, avg(decode(k.priority, 'P1', k.mttr * tickets)) val4, 'vale' tag4, '' num_tag4, '' den_tag4, 0 decimals4, 1 multiplier4, 4 order4, '' threshold4, 'value'unit4
from a k, B b
where k.submit_day between from_tz(to_timestamp('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') + numtodsinterval(1491019200000/1000, 'SECOND'), 'UTC') at time zone 'America/Chicago' and 
from_tz(to_timestamp('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') + numtodsinterval(1493524800000/1000, 'SECOND'), 'UTC') at time zone 'America/Chicago'
and k.column_common = b.column_common
user525146
  • 3,918
  • 14
  • 60
  • 103

0 Answers0