I have the following query.
Ordering the query gives me error:
ORA-01791: not a SELECTed expression
How do i order this query, first by colB, colC and ColA.
SELECT DISTINCT exch.colA ||'|'|| hol.colB ||'|'|| exch.colC
FROM ( SELECT bc.colA,
bc.colB,
ex.colC,
FROM tabA bc, tabB ex
WHERE AND bc.colA IS NOT NULL
AND ex.colB = bc.colB
AND ex.colB IS NOT NULL
GROUP BY bc.colA,
bc.colB,
ex.colC,
ORDER BY bc.colA) exch,
(SELECT *
FROM tabA
WHERE AND dt IS NOT NULL
AND dt >= TRUNC(TO_DATE ('09-JUL-10', 'dd-mon-yy'),'MONTH')
AND day_type = 'Myday') hol
WHERE hol.colA = exch.colA
ORDER BY exch.colA; <-- error on ordering
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.