Mike,

It think the solution suggested by Terry has a problem. What you actual find 
with that query is the objects in table2 that are within a distance of 100 
meters from the "current active" object in table1. With "current active" I mean 
the record that MapInfo at the moment has it's cursor pointing at.

So you are not comparing table2 to all the objects in table1, but only to a 
single object. Or do you see the result as if it was comparing to all the 
objects in table1 ?

Terry query is only missing a few words:

Select * 
from Table2 
where table2.obj within any (Select Buffer( table1.Obj, 1, 100, "m") >From 
table1)

Notice the difference in the where condition.

If you want to find objects in table 2 that are within a distance of 100 meter 
from a certain object in table1, this would be the way to do it:
1. Select the object in table1 that the objects in table2 should be within a 
distance of 100 meters of
2. Run this query:
        Select * 
        from Table2 
        where table2.obj within any (Select Buffer( selection.Obj, 1, 100, "m") 
>From selection)        

HTH,
Peter Horsbøll Møller
GIS Developer, MTM
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis

COWI har fået ny hjemmeside. Ydelserne GIS og IT, kort, kortlægning, 3D 
visualisering og arealforvaltning ligger under SAMFUND. Se mere her : 
www.cowi.dk

COWI has changed its homepage. Our services within cadastre and 
landadministration, geodataproducts, mapping and GIS can be seen under SOCIETY. 
See our services here: www.cowi.com


-----Original Message-----
From: Mike Tonge [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 30, 2005 5:00 PM
To: Terry McDonnell; mapinfo-l@lists.directionsmag.com
Subject: RE: MI-L SQL selects


Yep that got it working.  
 
Thanks
Mike

Terry McDonnell <[EMAIL PROTECTED]> wrote:
Mike

I haven't done this myself yet but does the below work?

HTH

Terry

Select * 
from Table2 
where table2.obj within Buffer( table1.Obj, 1, 100, "m")

-----Original Message-----
From: Mike Tonge [mailto:[EMAIL PROTECTED] 
Sent: 30 August 2005 14:16
To: Terry McDonnell
Subject: MI-L SQL selects

Hi List

I've got two MapInfo points tables and I wish to select all pairs where an 
object from one table is within 100m of an object in the other table. Can 
someone tell me the SQL syntax for doing this?


Thanks

Mike


---------------------------------
How much free photo storage do you get? Store your holiday snaps for FREE with 
Yahoo! Photos. Get Yahoo! Photos

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com | To 
unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 17660


                
---------------------------------
Yahoo! Messenger  NEW - crystal clear PC to PC calling worldwide with voicemail 

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 17671

Reply via email to