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!

filtering for records based on select criteria

padlerMar 31 2021

Hi,
I'm looking to build a sql query that will filter for IDs where the IDs are in multiple rows each with different emails and email source codes and want to test whether any of the source codes match a certain value and not include those in the output dataset. I have attached a document with an example
For example, say column A has ID "1" and has 3 rows of data. Each row has a different email address and a different source code. The first row has email1 and source code of "A", the second row has email2 and source code of "I", and the 3rd row has no email or source code. In this case, I want to test if ID 1 has any source code of "A" and exclude the ID in the output dataset because it includes the value of "A".
Alternatively, let's say there is another ID of "4" with 3 rows. The first row has email1 and source code of "I", the second row has email2 and source code of "Q", and the third row has no email or source code. In this case, because none of the rows for ID of "4" has a value of "A", I want to INCLUDE it in my output dataset.
image.pngSQL Data sample.xlsx (10.24 KB)
Thanks,
Pierre

This post has been answered by Frank Kulash on Apr 1 2021
Jump to Answer

Comments

Processing

Post Details

Added on Mar 31 2021
25 comments
2,503 views