Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 366F69FB99A for ; Mon, 25 Jun 2007 13:03:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 60010-01 for ; Mon, 25 Jun 2007 13:02:57 -0300 (ADT) X-Greylist: delayed 01:00:17.257808 by SQLgrey-1.7.5 Received: from mail8.tpgi.com.au (mail8.tpgi.com.au [203.12.160.46]) by postgresql.org (Postfix) with ESMTP id 778659FB3EE for ; Mon, 25 Jun 2007 13:02:56 -0300 (ADT) X-TPG-Antivirus: Passed Received: from freyja.local (60-240-41-118.static.tpgi.com.au [60.240.41.118]) by mail8.tpgi.com.au (envelope-from glenn@tangelosoftware.net) (8.13.6/8.13.6) with ESMTP id l5PG2fsi011209 for ; Tue, 26 Jun 2007 02:02:55 +1000 From: Glenn Davy Organization: Tangelo Software To: pgsql-novice@postgresql.org Subject: Re: another simple SQL question Date: Tue, 26 Jun 2007 02:02:46 +1000 User-Agent: KMail/1.9.6 References: <467FDF28.8000108@joshuaneil.com> In-Reply-To: <467FDF28.8000108@joshuaneil.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200706260202.46681.glenn@tangelosoftware.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/168 X-Sequence-Number: 19066 On Tue, 26 Jun 2007 01:28:40 am 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. > update yourtable set firstname= substring(fullname,1,position(',' in fullname)-1) ,lastname= substring(fullname, position(', ' in fullname)+2, char_length(fullname)); glenn > THANKS! > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend