2 Replies Latest reply: Sep 24, 2013 6:18 PM by davidp 2 RSS

    SQL query for zero or more than 1 row

    user521525

      have 2 tables Table1 and Table2

       

      Table1 contains one varchar2 column Col1 with values: id1, id2, id3, id4, .....id9

      Table2 contains two varchar2 columns with values:

      Col1     Col2

      id1     some1

      id1     some2

      id3     some3

      id4     some4

      id9     some5

      id9     some6

       

      Table1 and Table2 join on Table1.col1 = Table2.col1

       

      I want to find those rows in Table1 that have zero or more than one values in Table2

      So the output in the above case would be
      id1 (since it has more than one corresponding values in Table2)

      id2 (since it does not have corresponding value in Table2)

      id9 (since it has more than one corresponding values in Table2)