Re: find overlapping address ranges

From: Alex Rice <alex_rice(at)arc(dot)to>
To: pgsql-general(at)postgresql(dot)org
Cc: Tino Wildenhain <tino(at)wildenhain(dot)de>, Martijn van Oosterhout <kleptog(at)svana(dot)org>
Subject: Re: find overlapping address ranges
Date: 2002-09-17 15:38:49
Message-ID: 8F896852-CA53-11D6-8733-000393529642@arc.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Monday, September 16, 2002, at 08:18 PM, Martijn van Oosterhout
wrote:

> On Mon, Sep 16, 2002 at 09:45:46PM +0200, Tino Wildenhain wrote:
>> select c1.gid, c1.street, ... from cityplus c1, cityplus c2
>> where SOME_OVERLAPPING_CONDITION(c1..., c2...)
>
> Probably something like:
>
> a.streetname = b.streetname
> and a.numhigh > b.numlow
> and a.numlow < b.numhigh

Tino and Martijn, thanks for the suggestions. I'm on the right track
now. Couple more questions I would like to venture if I may...

1) In this table, fromleft toleft fromright toright are inconsistently
used: the "to" address are sometimes higher than the "from" address,
and the lefts may be odd or even and vice-versa. So I need to calculate
the numhigh and numlow before doing the comparison shown above. Can
this be done in SQL? I think it requires subquery?

2) If you could recommend a book on SQL, which one would you recommend?

Thanks,

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
alrice(at)swcp(dot)com
alex_rice(at)arc(dot)to

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2002-09-17 15:42:01 Re: advanced Apache authorization: updates triggered by select?
Previous Message Jan Wieck 2002-09-17 15:35:27 Re: advanced Apache authorization: updates triggered by