If you are sure that your words are space delimited, you may use this:

select regexp_replace('Ispahani Public School'||' ', '([^ ])([^ ]* )', '\\1', 'g');

Regards,
Ognjen


Timo Klecker wrote:
Try this:

SELECT regexp_matches('foobar beque bazil barf bonk', '(\\m.)', 'g')

Now you have the first letters, you can use array_to_string to get an string and use concat_str after this:

http://stackoverflow.com/questions/43870/how-to-concatenate-strings-of-a-string-field-in-a-postgresql-group-by-query

Mit freundlichen Grüßen

Timo Klecker

* *

* *

*Von:* pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] *Im Auftrag von *AI Rumman
*Gesendet:* Montag, 29. März 2010 10:45
*An:* pgsql-general General
*Betreff:* [GENERAL] need a query

I need a query to get the initial letter of the words:
Like:

Ispahani Public School -------- IPS
Ahmed Iftekhar -------- AI

Any help please.



--
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