DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Order by in UNION

  1. #1
    Join Date
    Apr 2003
    Posts
    15

    Order by in UNION

    Hi all

    How can I specify order by clause for the follwing query If I give the following query its giving the following error

    ERROR at line 3:
    ORA-00904: invalid column name

    If I remove 'order by a.Case_typ' its returning the rows.

    SELECT DISTINCT A.CASE_TYP||A.CASE_SNO||'/'||CASE_YR,A.PTY_TYP||'->'||A.ACU_RID||'.'||A.ACU_NAME||','||A.CASE_TYP||A.CASE_SNO||'/'||A.CASE_YR FROM VEFS_CRMACU A WHERE A.CASE_TYP = 'CC'
    union
    SELECT DISTINCT A.CASE_TYP,A.PTY_TYP||'->'||A.DPP_RID||'.'||A.DPP_NAME||','||A.CASE_TYP||A.CASE_SNO||'/'||A.CASE_YR FROM VEFS_CRMDPP A WHERE A.CASE_TYP = 'CC' order by a.Case_typ

    Thanks for your help

  2. #2
    Join Date
    Feb 2000
    Location
    Singapore
    Posts
    1,758
    Use the column position in order by clause.
    e.g. ORDER BY 1, 2, 3
    Sanjay G.
    Oracle Certified Professional 8i, 9i.

    "The degree of normality in a database is inversely proportional to that of its DBA"

  3. #3
    Join Date
    Apr 2003
    Posts
    15

    Thumbs up

    Thanks Sanjay

    Its working now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width