Skip to content
Advertisement

Many rows as a result of SELECT SQL

The table consists of the Record and Record author fields. There is an employee table with the Employee and His manager fields. It is necessary to read records from the first table that belong to a specific manager or his employees. I tried like this:

SELECT* FROM fgac_table WHERE
    note_owner = 'manager_1' 
    OR note_owner = (SELECT empoyer_name FROM employers_table WHERE his_manager_name = 'manager_1');

Issued: ORA-01427: single row subquery returns more than one row. How should I fix the request?

Advertisement

Answer

A simple “solution” is to change = to IN:

or note_owner in (select empoyer_name ...)

Or, simply join those table:

select f.*
from fgac_table f join employers_table e on e.his_manager_name = f.note_owner
where f.note_owner = 'manager_1'
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement