Hello Stephen, The problem with you query is due to operator precedence. The "not" is applying just to the obj and not the whole expression. A couple of brackets will fix your problem but, as others has stated, performance can be a real issue with large tables.
Select * from points where not (obj within any (select obj from polygon)) into Selection Regards, Warren Vick Europa Technologies Ltd. http://www.europa-tech.com -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Brooks, Stephen Sent: Wednesday, February 27, 2002 1:55 PM To: Mapinfo Mailing List Subject: RE: MI-L SQL Thanks to everyone else that helped out on this problem. The summary.... Invert selection does not work after you have made an SQL Query. Select * from points where not obj within any (select obj from polygon) into Selection (Applying this calculation made MI crash out instantly????? No idea why!) The only solution that seemed to work was using the Boundary Select tool from the tool bar and then invert selection. As far as I am aware this is the same as running a SQL Query and inverting. Why one way works and the other does not is another of MI little mysteries. Regards Stephen -----Original Message----- From: Martin Hodder [mailto:[EMAIL PROTECTED]] Sent: 26 February 2002 20:07 To: Mapinfo Mailing List; Brooks, Stephen Subject: Re: MI-L SQL Stephen, Lets say you have a table with polygons and a tables with points then the SQL is:- Select * from points where not obj within any (select obj from polygon) into Selection However this runs really sloww on large tables....... So you if you are using Version 6.5 you could join the two table using a within or contains clause and then run the invert selection command. This would be a lot quicker than my SQL above! Hope this helps Regards Martin ----- Original Message ----- From: "Brooks, Stephen" <[EMAIL PROTECTED]> To: "Mi-L (E-mail)" <[EMAIL PROTECTED]> Sent: Tuesday, February 26, 2002 5:37 PM Subject: MI-L SQL > Hi, > > Anyone know how to find all points NOT contained within a polygon? > > TIA > > Stephen Brooks > Steer Davies Gleave > 28-32 Upper Ground > London > SE1 9PD > > [tel] +44 (020) 7919 6781 > [fax] +44 (020) 7827 9851 > [email] [EMAIL PROTECTED] > > www.steerdaviesgleave.com > > > > _______________________________________________________________________ > List hosting provided by Directions Magazine | www.directionsmag.com | > To unsubscribe, send e-mail to [EMAIL PROTECTED] and > put "unsubscribe MapInfo-L" in the message body. > _______________________________________________________________________ List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MapInfo-L" in the message body. _______________________________________________________________________ List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MapInfo-L" in the message body.