Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002
    Posts
    227

    Unanswered: query very difficult.....

    Hi,
    I've this table: DIPENDENCES


    col1.................col2
    AA...................BB
    BB...................CC
    CC...................DD

    MM...................SS
    SS...................TT

    RR...................LL


    COL1 DEPEND FROM COL2

    I'd like to get this output:

    col1................col2
    AA..................BB
    AA..................CC
    AA..................DD

    MM..................SS
    MM..................TT

    RR..................LL


    I tried this query:

    select DISTINCT c.col1, g.col2
    from DIPENDENCES g,
    ( select DISTINCT col1, col2 from DIPENDENCES) c
    start with 'AA' ='AA'
    connect by prior g.col1 = g.col2
    order by 1;

    but I get this output:


    col1 col2
    AA BB
    AA CC
    AA DD
    AA NN
    AA SS

    BB BB
    BB CC
    BB DD
    BB NN
    BB SS

    CC BB
    CC CC
    CC DD
    CC NN
    CC SS

    MM BB
    MM CC
    MM DD
    MM NN
    MM SS

    NN BB
    NN CC
    NN DD
    NN NN
    NN SS



    Have you any idea????

    Thanks in advance!!!

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Because you have a Cartesian Product with table c, i.e. you have not specified any join.

Posting Permissions

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