pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sergio Andreozzi <sergio.andreozzi@gmail.com>
To: pgsql-sql@postgresql.org
Subject: how to generate a list of distinct scalar values from a column which type is array
Date: Wed, 21 Feb 2007 19:21:09 +0100
Message-ID: <2cfc7c940702211021u1ba47031l25112a69cfb18338@mail.gmail.com> (raw)

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

view thread (6+ messages)  latest in thread

Message-ID: <2cfc7c940702211021u1ba47031l25112a69cfb18338@mail.gmail.com>
Permalink:  ../2cfc7c940702211021u1ba47031l25112a69cfb18338@mail.gmail.com/
Also on:    postgresql.org/message-id/2cfc7c940702211021u1ba47031l25112a69cfb18338@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sergio.andreozzi@gmail.com
  Subject: Re: how to generate a list of distinct scalar values from a column which type is array
  In-Reply-To: <2cfc7c940702211021u1ba47031l25112a69cfb18338@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox