Search Postgresql Archives

Re: How to get normalized data from tekst column

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Andrus" <kobruleht2@xxxxxx> 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@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux