Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Oracle EXISTS

Posted on 2011-03-18
2
Medium Priority
?
252 Views
Last Modified: 2012-05-11
I have two tables

COMPANY
INTEROFFNOTE

Both tables have column names COMPANYACCNO

I need the output of those COMPANYACCNO which exists in BOTH COMPANY and INTEROFFNOTE
0
Comment
Question by:GRChandrashekar
  • 2
2 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 35170391
select companyaccno from company
intersect
select companyaccno from interoffnote
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 35170393
or try...


select companyaccno from company
where companyaccno in (
select companyaccno from interoffnote)


or ...


select companyaccno from company
where exists (select null  from interoffnote where company.companyaccno  = interoffnote.companyaccno )
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
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
Suggested Courses

971 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