SELECT
dba
,folder
,jsonb_agg(DISTINCT plevel) plevs
FROM
rlarp.cust
WHERE
status = 'A'
AND COALESCE(plevel,'') <> ''
AND plevel !~ 'XXX'
GROUP BY