Rich,

Assuming your points and regions are in the same table (called "Data") which
contains a unique ID column (Called "ID"), try the following series of
queries, in the given order:

****************************************************************************
**
SELECT ID, Obj FROM Data INTO TPoints WHERE Str$(Obj) = "Point"

SELECT ID, Obj, Area(obj, "sq mi") "Areas" FROM Data INTO TRegions WHERE
Str$(Obj) = "Region"

{Save TPoints and TRegions, then open the saved versions for use in the next
query.}

SELECT TRegions.ID, TRegions.Obj, Count(*) "Points", Areas FROM TRegions,
T_Points INTO RegionSummary
        WHERE TRegions.Obj Contains TPoints.Obj

SELECT ID, Points/Areas "Density" FROM RegionSummary INTO RegionDensity
****************************************************************************
**

The RegionDensity table contains your results.  I'm not positive about all
of the syntax, but this should prove helpful.  Perhaps somebody else can
provide a more efficient solution.

Take care,

Michael Hanna
Industrial Engineering
United Parcel Service Canada Ltd.
(905) 660-8688




-----Original Message-----
From: Rich Morris [mailto:rich_morris@;eli.net]
Sent: Wednesday, October 23, 2002 4:28 PM
To: MI Questions
Subject: MI-L SQL Query


Hello all,
    I have been having a hard time getting the syntax right for a query
I need to run.
    I have a table of points that lands over different
regions/boundaries.  I want to find the density or points/sq mi, and I
am at a loss unless I go to breaking up the two main tables into smaller
tables (1 set of points that only land in 1 region/boundary).
    Would anyone have any suggestions?
    Thanks in advance
rm



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

Reply via email to