Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 35C729FB9A7 for ; Mon, 25 Jun 2007 13:04:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 98448-02 for ; Mon, 25 Jun 2007 13:04:24 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from dbetts.vps.performancehosting.net (unknown [208.101.9.51]) by postgresql.org (Postfix) with SMTP id 1A5519FB3EE for ; Mon, 25 Jun 2007 13:04:24 -0300 (ADT) Received: (qmail 25919 invoked by uid 702); 25 Jun 2007 16:04:24 -0000 Received: from unknown (HELO ?127.0.0.1?) (75.162.185.96) by performancehosting.net with SMTP; 25 Jun 2007 16:04:24 -0000 Message-ID: <467FE784.3060606@blueaxis.com> Date: Mon, 25 Jun 2007 10:04:20 -0600 From: Derrick Betts Reply-To: list@blueaxis.com Organization: Blue Axis User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) MIME-Version: 1.0 To: Joshua CC: pgsql-novice@postgresql.org Subject: Re: another simple SQL question References: <467FDF28.8000108@joshuaneil.com> In-Reply-To: <467FDF28.8000108@joshuaneil.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/169 X-Sequence-Number: 19067 Try this: SELECT substr(fullname, 1, position(',' IN fullname)-1) AS first, trim(substr(fullname, position(',' IN fullname)+1, length(fullname))) AS last FROM table_name; Joshua wrote: > 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. > > THANKS! > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > > >