Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id D884C9FBA9F for ; Wed, 21 Feb 2007 14:21:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 50172-05 for ; Wed, 21 Feb 2007 14:21:09 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.228]) by postgresql.org (Postfix) with ESMTP id 257059FB375 for ; Wed, 21 Feb 2007 14:21:10 -0400 (AST) Received: by nz-out-0506.google.com with SMTP id i11so2618356nzh for ; Wed, 21 Feb 2007 10:21:09 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=H9PS8NGjM45GCoIbZyJZxVVOjujFRdG1zyiUg6Z8rmbrvURRuarlJv9GkNIi1VqwO66zNvWRfpCKl+xXyZZXwqKfguBRmGBPkuT+e1YB/WLJjnbgI/dgSu/9DDhpDFStb6toZfb3HvoLyOiWO+UXV79WO9/MHJUwkper867xhxo= Received: by 10.64.180.20 with SMTP id c20mr6261571qbf.1172082069254; Wed, 21 Feb 2007 10:21:09 -0800 (PST) Received: by 10.64.184.11 with HTTP; Wed, 21 Feb 2007 10:21:09 -0800 (PST) Message-ID: <2cfc7c940702211021u1ba47031l25112a69cfb18338@mail.gmail.com> Date: Wed, 21 Feb 2007 19:21:09 +0100 From: "Sergio Andreozzi" To: pgsql-sql@postgresql.org Subject: how to generate a list of distinct scalar values from a column which type is array MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6963_10306342.1172082069200" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.883 tagged_above=0 required=5 tests=AWL, BAYES_50, HTML_30_40, HTML_MESSAGE, SPF_PASS X-Spam-Level: * X-Archive-Number: 200702/214 X-Sequence-Number: 27548 ------=_Part_6963_10306342.1172082069200 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ------=_Part_6963_10306342.1172082069200 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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

------=_Part_6963_10306342.1172082069200--