Get max value from an comma separated string

From: Mauro Bertoli <bertolima(at)yahoo(dot)it>
To: pgsql-sql(at)postgresql(dot)org
Subject: Get max value from an comma separated string
Date: 2006-05-29 11:22:38
Message-ID: 20060529112238.61079.qmail@web27009.mail.ukl.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Chiacchiera con i tuoi amici in tempo reale!
http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Chille 2006-05-29 20:14:17 distinct aggregate with complex type dont see the equality operator
Previous Message Andrew Sullivan 2006-05-29 11:06:49 Re: hi still i am unable to provide encryption to a particular table....