Solved

Simple SQL Code

Posted on 2014-01-30
3
265 Views
Last Modified: 2014-01-30
I've got two tables.  One ID's has and id the other, names, has id plus first_name and last_name.  Names has five rows all of which match on id.  When i do something like:
select ID.id, names.first, names.last from ID, name where ID.id=names.id;
I want only a single match to be returned, not five rows.
0
Comment
Question by:xoxomos
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 250 total points
ID: 39822270
select ID.id, names.first, names.last from ID, name where ID.id=names.id and rownum=1;

Do you want a specific one or just any one?
0
 

Author Comment

by:xoxomos
ID: 39822290
I think they want any one at this point :-) thanks
0
 

Author Closing Comment

by:xoxomos
ID: 39822304
Perfect
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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

809 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