Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problems with Subselect, more rows than needed

User_632EJMar 18 2019 — edited Mar 18 2019

I have a query which is supposed to be embedded as a subselect statement later. It however yields more than one column as a result, which obviously returns to many values.

The statement looks like this:

select

     a.some_primary_key

     , b.some_column

     , count(b.some_column)

from

     a join b ...

where

     ...

group by

     a.some_primary_key

     , b.some_column

having

     count(b.some_column) > 1

Then I would like to use whatever results are given in the "a.some_primary_key"-column for another query, which would look like this.

select

     *

frome

     some_view

where

     some_view.some_primary_key in (

          ...

     )

Is there a way to somehow omit the other columns (b.some_column, count(b.some_column) )?

Thanks in advance.

Comments
Post Details
Added on Mar 18 2019
9 comments
760 views