| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Box query
Mikito Harakiri wrote:
> Mikito Harakiri wrote:
> > Given a set of n-dimensional boxes
> > find all the pairs that intersect...
>
> table boxes (
> *id* integer,
> dimension# integer,
> low integer,
> high integer
> )
Here is relational division style of query:
select b1.id as box1, b2.id as box2, b1.dim
from boxes b1, boxes b2
where b1.low between b2.low and b2.high
and b1.dim = b2.dim
group by b1.id, b2.id
having count(1) = (
select count(1) from boxes b3
where b3.id = b1.id
and b3.dim=b1.dim
Yet, again with Bob's solution I can't claim it to be "special" anymore... Received on Fri Apr 21 2006 - 21:14:12 CDT
![]() |
![]() |