Solved

Find matching records

Posted on 2009-04-11
3
269 Views
Last Modified: 2013-12-18
I have a table that stores and OP_ORG_ID, OP_ID and ORG_ID associated with each OP_ID.

An example would be like
OP_ORG_ID, OP_ID, ORG_ID
114, 12345, 10
115, 12345, 40

I want to be able to query the table and find all instances where an OP_ID has both ORG_ID 10 and 40 associated to it
0
Comment
Question by:bhinshawnc1
3 Comments
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 500 total points
Comment Utility
Hope this helps you out
SELECT OP_ID

FROM urtable

WHERE ORG_ID IN ( 10, 40) 

GROUP BY OP_ID

HAVING COUNT(ORG_ID) = 2

Open in new window

0
 
LVL 14

Expert Comment

by:ajexpert
Comment Utility
Your question is not clear.  Do you have multiple tables having OP_ID column?
Can you provide more data and table structures?
0
 
LVL 3

Author Closing Comment

by:bhinshawnc1
Comment Utility
Thanks, this got me going in the right direction as part of a larger query I was building.
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

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‚Ķ
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

762 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