I have some data that looks something like this:
key B
1 true
1 false
2 false
2 false
And I want to roll it up so that if column B
has two false
values then the resulting value for B
is false
; otherwise, if there is a true
and false
value the value for B
is true
. Like this:
key B
1 true
2 false
Is there a way that this can be done with (Snowflake) SQL? I first thought of a pivot table but this doesn't quite seem to be what pivots do.
Best Answer
According to your text if any of them are true is must be true, otherwise is false:
db<>fiddle here