?
Solved

Find matching records

Posted on 2009-04-11
3
Medium Priority
?
276 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 2000 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

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 …
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…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

777 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