Skip site navigation (1) Skip section navigation (2)

Re: Merging two columns into one

From: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
To: Gary MacMinn <G(dot)MacMinn(at)nca(dot)gov(dot)au>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Merging two columns into one
Date: 2000-06-23 11:35:37
Message-ID: m135RkH-000AY3C@druid.net (view raw or flat)
Thread:
Lists: pgsql-sql
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 <darcy(at){druid|vex}.net>   |  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.

In response to

Responses

pgsql-sql by date

Next:From: D'Arcy J.M. CainDate: 2000-06-23 11:40:25
Subject: Re: Merging two columns into one
Previous:From: D'Arcy J.M. CainDate: 2000-06-23 11:29:01
Subject: Re: Using substr with user defined types

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group