"Andrus" <kobrule...@hot.ee> writes:

> David,
>>Regular Expressions are your friend here.  If you do not know them you
> should learn them; though if you ask nicely someone may just provide you
> the solution you need.
>>Split-to-array and unnest may work as well.
>  
> Thank you very much. I dona**t know regexps.
> Can you provide example, please for 8.1. Or maybe CASE WHEN and substring
> testing can also used.

The query

SELECT id, a[1] AS name, a[2] AS percent
FROM (
    SELECT id, regexp_split_to_array(regexp_split_to_table(comment, ', *'), 
'\W+') AS a
    FROM project
  ) AS dummy

should work un every halfway recent PostgreSQL version - dunno about 8.1.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to