Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 2EC679FB7C6 for ; Mon, 25 Jun 2007 12:44:28 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 58597-03 for ; Mon, 25 Jun 2007 12:44:23 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 54C4B9FB8CD for ; Mon, 25 Jun 2007 12:44:23 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mini.magehandbook.com (static-68-163-72-180.res.east.verizon.net [68.163.72.180]) by svr4.postgresql.org (Postfix) with ESMTP id 6627D5AF031 for ; Mon, 25 Jun 2007 15:44:22 +0000 (GMT) Received: from magehandbook.com (localhost [127.0.0.1]) by mini.magehandbook.com (Postfix) with ESMTP id AC1A9194513 for ; Mon, 25 Jun 2007 11:44:20 -0400 (EDT) Received: from 63.172.115.138 (SquirrelMail authenticated user daniel) by MageHandbook.com with HTTP; Mon, 25 Jun 2007 11:44:20 -0400 (EDT) Message-ID: <58669.63.172.115.138.1182786260.squirrel@MageHandbook.com> In-Reply-To: <467FDF28.8000108@joshuaneil.com> References: <467FDF28.8000108@joshuaneil.com> Date: Mon, 25 Jun 2007 11:44:20 -0400 (EDT) Subject: Re: another simple SQL question From: "Daniel T. Staal" To: pgsql-novice@postgresql.org User-Agent: SquirrelMail/1.4.4 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/167 X-Sequence-Number: 19065 On Mon, June 25, 2007 11:28 am, Joshua said: > Ok here is another simple question from a novice.... > > Here is what my table looks like > > firstname lastname fullname > ---------- ---------- ----------- > smith, john > green, susan > white, jeff > > > How can I break the fullname field into firstname lastname fields so it > looks like the following: > > firstname lastname fullname > --------- --------- --------- > john smith smith, john > susan green green, susan > jeff white white, jeff > > Please let me know. Sorry for such simple novice questions, I appreciate > your support. The best way to handle this would actually be to break it _before_ putting it in to the database. In fact, you can just have the first and last name fields then and get the 'fullname' from combining the two. (Assuming you don't care about middle names, appliations, or the anything else.) That's just a comment: I don't know what stage you are in on this database project. Assuming you have the database and need to work with it my response to the above would be to write a perl script to go through and populate the first and last name fields. There may be an easier way though. Daniel T. staal --------------------------------------------------------------- This email copyright the author. Unless otherwise noted, you are expressly allowed to retransmit, quote, or otherwise use the contents for non-commercial purposes. This copyright will expire 5 years after the author's death, or in 30 years, whichever is longer, unless such a period is in excess of local copyright law. ---------------------------------------------------------------