'select all "groups/partitions" where parameter is found

Without going into too much detail - I need to create groups (grouped on a specific field) of data and then display all GROUPS of records that contain a parameter. I need all records in a GROUP even if some do not match the parameter. Any GROUPS where no records contain the parameter would be suppressed.

I'm working with db2 and I just need help with the basic syntax. I'm thinking a PARTITION_BY used within a subquery might be the correct approach. Any ideas? Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source