Skip to content
Advertisement

Select distinct columns for which all rows meet a condition

I want to select the distinct a, b‘s for which all the c‘s have a specific value (in my case null)

So given the rows below

the result should be

I have failed to successfully translate that to a query, could you please help me out?

Advertisement

Answer

Try:

where bool_and is a postgres aggregate function.

Or maybe this, should work with ANSI sql I think:

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