| From: | Ragnar <gnari(at)hive(dot)is> |
|---|---|
| To: | Joshua <joshua(at)joshuaneil(dot)com> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: yet another simple SQL question |
| Date: | 2007-06-25 18:33:14 |
| Message-ID: | 1182796394.5953.294.camel@localhost.localdomain |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general pgsql-novice pgsql-sql |
On mán, 2007-06-25 at 12:44 -0500, Joshua wrote:
> I have a column that looks like this
>
> firstname
> -----------------
> John B
> Mark A
> Jennifer D
>
> Basically I have the first name followed by a middle initial. Is there a
> quick command I can run to strip the middle initial?
how about:
select regexp_replace(firstname,' .*','') as firstname
from footable;
or:
select substring(firstname FROM '(.*) ') as firstname
from footable;
gnari
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Erik Jones | 2007-06-25 18:42:48 | Standby servers and incrementally updated backups |
| Previous Message | Magnus Hagander | 2007-06-25 18:20:29 | Re: Automatic install on windows |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Erik Jones | 2007-06-25 19:03:58 | Re: yet another simple SQL question |
| Previous Message | A. Kretschmer | 2007-06-25 18:07:17 | Re: [SQL] yet another simple SQL question |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Erik Jones | 2007-06-25 19:03:58 | Re: yet another simple SQL question |
| Previous Message | A. Kretschmer | 2007-06-25 18:07:17 | Re: [SQL] yet another simple SQL question |