Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Query to Identify Sets Having Given Pattern

644850Jun 16 2008 — edited Jun 16 2008
Hi,

Assume that i have following table

Id Code
1 aaa
1 bbb
1 ccc
2 aaa
2 bbb
2 ddd
3 bbb
3 eee

The records will be grouped by Id. I want to identify sets having following criteria
1. Set should have at least one record with code like 'a%'
and should have at least one record for codes 'bbb', 'ccc' (in this case group 1 would be selected)
2. Set should have at least one record with code like 'a%'
and should have at least one record for either 'bbb' or 'ccc' (in this case group 1and 2 would be selected)

Does anyone have idea about how this could be achieved efficiently? Any pointers, references would be appreciated

Regards
~Pravin.

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jul 14 2008
Added on Jun 16 2008
5 comments
1,397 views