Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id BBDED9FB277; Mon, 25 Jun 2007 16:04:17 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 06449-03; Mon, 25 Jun 2007 16:04:13 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from smtp150.iad.emailsrvr.com (smtp150.iad.emailsrvr.com [207.97.245.150]) by postgresql.org (Postfix) with ESMTP id 2CEE09FB6C8; Mon, 25 Jun 2007 16:04:12 -0300 (ADT) Received: from [10.0.33.40] (unknown [70.90.199.206]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: erik@myemma.com) by relay5.relay.iad.emailsrvr.com (SMTP Server) with ESMTP id 3E90560D578; Mon, 25 Jun 2007 15:04:06 -0400 (EDT) In-Reply-To: <467FFEF9.5050603@joshuaneil.com> References: <467FFEF9.5050603@joshuaneil.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <37E566AC-D304-4D52-920B-7FA61D7777FD@myemma.com> Cc: pgsql-sql@postgresql.org, pgsql-novice@postgresql.org, pgsql-general@postgresql.org Content-Transfer-Encoding: quoted-printable From: Erik Jones Subject: Re: yet another simple SQL question Date: Mon, 25 Jun 2007 14:03:58 -0500 To: Joshua X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/1457 X-Sequence-Number: 116280 On Jun 25, 2007, at 12:44 PM, Joshua wrote: > Ok, > > You guys must be getting sick of these newbie questions, but I =20 > can't resist since I am learning a lot from these email lists and =20 > getting results quick! Thanks to everyone for their contributions. > > Here is my questions.... > > 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 =20 > there a quick command I can run to strip the middle initial? =20 > Basically, I just need to delete the middle initial so the column =20 > would then look like the following: > > firstname > --------------- > John > Mark > Jennifer > > Thanks again for all of your help today. Everything you guys have =20 > been sending has produced successful results. > Try something along the lines of: SELECT substring(firstname from '^(\w*)\W') from table_name; Erik Jones Software Developer | Emma=AE erik@myemma.com 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate & market in style. Visit us online at http://www.myemma.com