Solved

Find matching records

Posted on 2009-04-11
3
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 500 total points
ID: 24122639
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
ID: 24122659
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
ID: 31569198
Thanks, this got me going in the right direction as part of a larger query I was building.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
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…
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 explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

696 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