Received: from druid.net (root@druid.net [216.126.72.98]) by hub.org (8.10.1/8.10.1) with ESMTP id e5NBZk177708 for ; Fri, 23 Jun 2000 07:35:46 -0400 (EDT) Received: from localhost (1413 bytes) by druid.net via sendmail with P:stdio/R:bind_hosts/T:inet_zone_bind_smtp (sender: ) (ident using unix) id for ; Fri, 23 Jun 2000 07:35:37 -0400 (EDT) (Smail-3.2.0.109 1999-Oct-27 #1 built 1999-Dec-25) Message-Id: From: darcy@druid.net (D'Arcy J.M. Cain) Subject: Re: Merging two columns into one In-Reply-To: "from Gary MacMinn at Jun 23, 2000 01:04:59 pm" To: Gary MacMinn Date: Fri, 23 Jun 2000 07:35:37 -0400 (EDT) CC: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL78 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200006/204 Thus spake Gary MacMinn > I have two columns in a table (areacode and phone number) that I'd like to merge into one (phone number) containing both sets of info. Could anyone suggest a simple way of achieving this? Oliver showed you how to merge these together with the SQL concatenate operator but there is another possibility. PostgreSQL could use a phone number type. I have been meaning to write a user defined type for some time but never seem to get around to it. Maybe you could give this a shot. The examples in contrib should get you started. Once finished you can make the phone # one column and split out parts with various functions. Don't forget to have a place for country code and extension. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.