Reputation: 23
I have problem converting a boolean array like {true,true}
or {}
.
The result should be true
and null
, respectively.
What I have currently is {true,}
, {true,true}
and {}
.
But I need the result as true
, true
and null
. Please help.
My query is:
select t, array_agg(distinct abc) as abc
from tbl
I want to convert array_agg
to a single boolean or string value.
Upvotes: 0
Views: 634
Reputation: 247235
Don't use array_agg
. Use bool_or
instead:
SELECT t, bool_or(abc) AS abc
FROM tbl;
Upvotes: 1