# Thread: Select .... Where Not.... ???

1. Registered User
Join Date
Nov 2003
Posts
2

## Unanswered: Select .... Where Not.... ???

Hi everybody!
I have a table in my database which containes the coordinates of corners of the boxes of the grid(the boxes can be any shape). It looks like this:

i j x1 y1 x2 y2 x3 y3 x4 y4

x1 x2= x3 x4
--------o----o---o------------ y1
| /\ |
| / \ |
| / \ |
| / \ |
| / \ | y2=y3
| \ / |
| \ / |
| \ / |
| \ / |
| \/ |
---------------------------- y4
I also have the point (x,y) and I need to define if this point is in the orthogonal box limited by the lines. I tryed to do it like this:

select * from table where not (((x<x1) and (x<x2) and (x<x3) and (x<x4)) or ((x>x1) and (x>x2) and (x>x3) and (x>x4)) or ((y<y1) and (y<y2) and (y<y3) and (y<y4)) or (((y>y1) and (y>y2) and (y>y3) and (y>y4)));

To say it in words : I want to select all the records where all 4 corners of the boxes are not from the left of the point, are not from the right of the point, are not below the point or are not beyond the point.
It didn't work. Does anybody have an idea how can I make it work?
I know my explanation is kind of messy, but please ask me if you are confused by it.

Thank you,

Elena

2. Registered User
Join Date
Nov 2003
Posts
2
Sorry, the box which I tryed to draw was submitted in a very strange way... i just trryed to draw the box and the coordinates.

3. Registered User
Join Date
Oct 2003
Posts
63
Hi!

I think you need to draw it in any graphical editor and post this there by attaching.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•