Sam,
Maybe something like: SELECT MAX(nullif(regexp_replace(test, '^([0-9]*).*$', E'\\1'),'')::INT);
Thank you. This seems to work but is bit slow. How to speed it up ? Should I create indexCREATE INDEX test ON test ( nullif(regexp_replace(test, '^([0-9]*).*$', E'\\1'),'')::INT );
?Andrus.
-- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general