I have executed similar SQL's using this distance function. I'm not sure either why a join has to be specified, but it does. Modify the structure of each table to include a column called, say, JOIN. Ensure that all values in this column = 0. In the SQL Where Condition clause, use table1.join=table2.join. This ensures that each point in the first table is compared to each point in the second. Regards _________________________ Peter Walsh Dames & Moore Phone +61 8 9221 1630 email [EMAIL PROTECTED] -----Original Message----- From: Andrew Bailey [mailto:[EMAIL PROTECTED]] Sent: Friday, January 15, 1999 7:30 PM To: mapinfo mailing list Subject: MI q> SQL to select buildings 1 mile or more from hospital point set hi there i have two tables: 'buildings_in_Hackney' which are polylines and 'hospitals' which are points i wish to find which buildings are more than a certain distance #away# from the hospital points. I constructed a SQL select which i have summarised below; select columns * from Tables: hospitals, buildings_in_Hackney where condition: Distance(CentroidX(Hospital.obj),CentroidY(Hospital.obj),CentroidX(Build ings _in_Hackney.obj),CentroidY(Buildings_in_Hackney.obj),"mi")>=1 group by columns: order by columns: into Table Named: Selection Verification says ok, but i get an error message upon submission: 'No join specified between Hospital and Buildings_In_Hackney. Invalid join condition in Where clause' I've tried swapping round the order of the tables in 'from Tables' line but to no avail. I'm unfamiliar why a join needs to be made between the two tables: they both appear on the same map window and obviously georeferenced correctly - but even more bobviously i'm missing something rather important. I think my Distance function is correct - i modified one i found at the back of the user manual (v5) regards andy Andrew Bailey GIS Officer Estate Management and Development Strategy and Commissioning Christopher Addison House 72 Wilton Way London E8 1BJ Tel: 0181 356 2227 Home email: [EMAIL PROTECTED] The views expressed are not necessairly the views of LBH. ---------------------------------------------------------------------- To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED] ---------------------------------------------------------------------- To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
