gshilin
gshilin

Reputation: 676

Combining rows by key and expression

I've got a table

email::string
location::string
day_1::boolean
day_2::boolean
...

Now I need to get for each email OR of days. For the following input

[email protected] | location1 | true  | false
[email protected] | location2 | false | true

I want to get

[email protected] | true  | true

Upvotes: 1

Views: 28

Answers (1)

Simo Kivistö
Simo Kivistö

Reputation: 4503

SELECT email, bool_or(day_1) AS day_1, bool_or(day_2) AS day_2 FROM your_table GROUP BY email

Upvotes: 1

Related Questions