how to generate a list of distinct scalar values from a column which type is array

From: "Sergio Andreozzi" <sergio(dot)andreozzi(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: how to generate a list of distinct scalar values from a column which type is array
Date: 2007-02-21 18:21:09
Message-ID: 2cfc7c940702211021u1ba47031l25112a69cfb18338@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Dear all,

given a column which type is for instance varchar(20)[], is there any SQL
command that let me generate the list of distinct scalar values?

e.g.:
col1
row 1: (aaa, bb, c)
row 2: (dddd, eeee)
row 3: (aaa, eeee)

the query should return:

aaa
bb
c
dddd
eeee

if not, I guess the approach is to use stored procedure. Any code
snippet/suggestion?

Thanks, Sergio

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jasbinder Singh Bali 2007-02-21 19:21:13 Sockets in perl (Db transaction ends abnormally at client when server closes client socket)
Previous Message Merlin Moncure 2007-02-21 17:47:02 Re: postgresql vs mysql

Browse pgsql-sql by date

  From Date Subject
Next Message Martin Marques 2007-02-21 21:17:50 Problems with temp table and PL
Previous Message devil live 2007-02-21 11:52:03 Re: Problem with Temp Table and Result Set from PL Function...