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

Re: Weird join...

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Costin Manda <costin(at)interpoint(dot)ro>
Cc: pgsql <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Weird join...
Date: 2004-07-12 14:37:33
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Mon, Jul 12, 2004 at 12:47:41 +0300,
  Costin Manda <costin(at)interpoint(dot)ro> wrote:
>   I need to join two tables in postgres (or any other SQL) like this:
> table 1 has a list of phone numbers
> table 2 has a list of country prefixes (like 40 for romania 407 for romania
> mobile, etc)
> I want to join the tables so that a number like
> 407111111 in table 1
> is joined ONLY with
> 407 in table 2
> Can you please help?

You should keep the country prefixes as a separate column in the table with
the full numbers. It might also be useful to break out area/city code
from the local phone number.
You also might want to store both the IDD prefixes (there can be multiple
ones for some countries) and the NDD prefixes for the phone numbers.

In response to


pgsql-novice by date

Next:From: David.VentimigliaDate: 2004-07-12 16:11:18
Subject: FW: table inheritance and polymorphic functions
Previous:From: Costin MandaDate: 2004-07-12 09:47:41
Subject: Weird join...

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