We help IT Professionals succeed at work.
Get Started

ORA-22818: subquery expressions not allowed here - Group BY

xbox360dp
xbox360dp asked
on
2,966 Views
Last Modified: 2012-07-18
Gurus,

How do I get around the fact that I can't add a subquery to my group by clause and get the result I need?

SELECT kat.katkeyi,
  vgb.vgbbezc ,
  dok.dokkeyi,
  abp.abpbezc,
  dok.dokinfc,
  NVL (zplbezc, 'No TimePlan'),
  DOK.DOKOWNC,
  stragg (dok.doknlc),
(SELECT AFL.AFLFLDC
  FROM AFL
  INNER JOIN FTY
  ON AFL.AFLFTYKEYI  = FTY.FTYKEYI
  WHERE FTY.FTYBEZC  = 'LTtableID'
  AND AFL.AFLARTKEYI = ART.ARTKEYI
  AND AFL.AFLKAVKEYI = ART.ARTKAVKEYI
  ) AS lttableid
FROM kat, dok, vgb, abp, zpl
WHERE zpl.zplabpkeyi(+) = abp.abpkeyi
AND kat.katvgbkeyi      = vgb.vgbkeyi
AND dok.dokkatkeyi      = kat.katkeyi
GROUP BY kat.katkeyi, vgb.vgbbezc, dok.dokkeyi, abp.abpbezc, dok.dokinfc, zpl.zplbezc, DOK.DOKOWNC,
  (SELECT AFL.AFLFLDC
  FROM AFL
  INNER JOIN FTY
  ON AFL.AFLFTYKEYI  = FTY.FTYKEYI
  WHERE FTY.FTYBEZC  = 'LTtableID'
  AND AFL.AFLARTKEYI = ART.ARTKEYI
  AND AFL.AFLKAVKEYI = ART.ARTKAVKEYI);

ORA-22818: subquery expressions not allowed here
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE