[GENERAL] How to get array of unique array values across rows?

2013-03-05 Thread Ken Tanzer
I have a field containing a set of codes in a varchar array, each tied to a person. client_id | integer | service_codes | character varying(10)[] | I'm trying to query this info so that I can get the list (presumably in an

Re: [GENERAL] How to get array of unique array values across rows?

2013-03-05 Thread Ken Tanzer
That worked perfectly. Thanks a lot! On Tue, Mar 5, 2013 at 12:49 PM, ChoonSoo Park luisp...@gmail.com wrote: Try this one. select X.client_id, array_agg(X.color) from (select distinct client_id, unnest(service_codes) as color from foo) X group by X.client_id; On