Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2005
    Posts
    1

    Unanswered: Sql Query Problem.. Nedd Urgent Help..!!

    I hav written a query whose output is:

    XXX CCCCC YYY
    p CCCCC m
    p CCCCC n
    p CCCCC o
    q CCCCC m
    q CCCCC n
    q CCCCC o

    but i need this output:

    XXXCCCCC YYY
    p CCCCC m
    q CCCCC n
    CCCCC o

    there is no correspondense between XXX & YYY column.p,q,m,n,o may appear in any order. Is it possible? i am new to sql please give some idea ...
    thanks in advance.database is oracle 8i.

  2. #2
    Join Date
    Nov 2002
    Posts
    272
    I don't have an Oracle instance to test this on, but I think

    SELECT x.xxx, y.yyy from
    (Select ROWNUM, xxx from table1) x
    FULL OUTER JOIN
    (Select ROWNUM, yyy from table2) y
    ON x.ROWNUM = y.ROWNUM

    just might work.

  3. #3
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Maybe you want something like
    Code:
    SELECT DISTINCT xxx FROM mytable ;
    SELECT DISTINCT yyy FROM mytable
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

Posting Permissions

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