Skip to content
Advertisement

Check if repeated row has value in one attribute in any of the rows

I have a table that looks like this:

I would like to extract for each ID if it contains a specific value.

In this case, if that value is 5 I would need a table like this:

Any solutions or hints about how could I do it? Thanks.

Advertisement

Answer

You can use group by and conditional counting:

Another option is to use the bool_or() aggregate:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement