Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

oracle query

Options
  • 19-02-2004 5:00pm
    #1
    Registered Users Posts: 618 ✭✭✭


    I have to join 2 columns in the same table. The join has to be distinct as i want to put the result into a combo box. I have received the following error when i execute my sql statement. I am sorry for all programmers i know this is a database probs any suggestion please


    SQL> select DISTINCT(Street1) from Map Where Street1 != (select DISTINCT(Street2) from Map);



    select DISTINCT(Street1) from Map Where Street1 != (select DISTINCT(Street2) from Map)
    *
    ERROR at line 1:
    ORA-01427: single-row subquery returns more than one row


Comments

  • Registered Users Posts: 19,396 ✭✭✭✭Karoma


    i'm tired and possibly completely missing the point, but
    select DISTINCT(Street1) from Map Where Street1 != Street2

    would work (?) .. it makes more comparisons (performance drop) ..but it's straight forward and works..

    although you say you want to "join" the two columns... that isn't a join. select column1,column2 ....


  • Registered Users Posts: 618 ✭✭✭johnnyc


    Thanks very much that guery is right?


Advertisement