Re: Get max value from an comma separated string - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: Get max value from an comma separated string
Date
Msg-id 20060605021239.GA6293@wolff.to
Whole thread Raw
In response to Get max value from an comma separated string  (Mauro Bertoli <bertolima@yahoo.it>)
List pgsql-sql
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.


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: datestyle on windows environment: how to set?
Next
From: Andrew Sullivan
Date:
Subject: Re: Using Query Result in WHERE Clause