Solved

SELECT first record

Posted on 2001-09-05
3
1,709 Views
Last Modified: 2010-05-18
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?


0
Comment
Question by:vd
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
ser6398 earned 50 total points
Comment Utility
select *
from my_table
where rownum <= 1
0
 
LVL 5

Expert Comment

by:ser6398
Comment Utility
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
     );


0
 

Author Comment

by:vd
Comment Utility
Thanks!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now