Link to home
Start Free TrialLog in
Avatar of vd
vd

asked on

SELECT first record

I have a simple subquery in an Oracle SQLPLUS SELECT, but it returns > 1 records.
How do I  select only the first or top record?


ASKER CERTIFIED SOLUTION
Avatar of ser6398
ser6398

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ser6398
ser6398

other options in a subquery:

select *
from my_table1
where id = (
  select max(id)
  from my_table2
            );


or


select *
from my_table1
where id IN (
  select id
  from my_table2
     );


Avatar of vd

ASKER

Thanks!