Re: yet another simple SQL question - Mailing list pgsql-sql

From Ragnar
Subject Re: yet another simple SQL question
Date
Msg-id 1182796394.5953.294.camel@localhost.localdomain
Whole thread Raw
In response to yet another simple SQL question  (Joshua <joshua@joshuaneil.com>)
List 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




pgsql-sql by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: yet another simple SQL question
Next
From: Erik Jones
Date:
Subject: Re: [GENERAL] yet another simple SQL question