pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Mauro Bertoli <bertolima@yahoo.it>
Cc: pgsql-sql@postgresql.org
Subject: Re: Get max value from an comma separated string
Date: Sun, 4 Jun 2006 21:12:39 -0500
Message-ID: <20060605021239.GA6293@wolff.to> (raw)
In-Reply-To: <20060529112238.61079.qmail@web27009.mail.ukl.yahoo.com>
References: <20060529112238.61079.qmail@web27009.mail.ukl.yahoo.com>

On Mon, May 29, 2006 at 13:22:38 +0200,
  Mauro Bertoli <bertolima@yahoo.it> wrote:
> Hi, I've a field that contain values-comma-separated
> like
> A) 1;2;3;;5  -- ;2;;4;5
> but also
> B) 12;34;18
> how I can get the max value?
> For A I tried:
> SELECT max(array_upper(string_to_array(answer,';'),1))
> FROM values;
> and work fine, but for B case I don't find a solution
> like
> SELECT max(string_to_array(answer,';')) FROM values;
> 
> Any ideas?
> Thanks for any hint

Don't store the data like that in the database if possible.



view thread (3+ messages)  latest in thread

Message-ID: <20060605021239.GA6293@wolff.to>
Permalink:  ../20060605021239.GA6293@wolff.to/
Also on:    postgresql.org/message-id/20060605021239.GA6293@wolff.to

 · 

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: bruno@wolff.to, bertolima@yahoo.it
  Subject: Re: Get max value from an comma separated string
  In-Reply-To: <20060605021239.GA6293@wolff.to>

* 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