1

I using 3 different tables which are also geographical objects:

  • population data; points on the map representing inhabitants (1 or more)
  • region data; the map is divided in regions
  • coverage data; it contains several coverage areas overlapping or not

What I am searching for is: What is the percentage of people covered by a certain coverage area in a certain region?

I tried several things but nothing worked, for example with SQL select I tried:

Select Columns: Regions.name, CoverageArea.name, Sum(Population.inhabitants)

from Tables: Regions, CoverageArea, Population

where Condition: Regions.obj Contains Population.obj And CoverageArea.obj Contains Population.obj

Group by Columns: 1, 2

Order by Columns: 1, 2

into Table Named: Selection

"And I get Incorrect tables are joined. Invalid join condition in WHERE clause."

Hope I was clear enough :s

** edit **

Few tests I did. I can't understand why the thrid SQL query doesn't work...

Population per coverage area

Population per region

Trying to get population per region and coverage area

Error message

1

I know you can join at least three tables using alfanumerical values, but I have never tried doing it using a spatial join.

But you need to make sure that your join matches the order of the tables:

where table1.some_column = table2.some_column
and table2.some_column = table3.some_column

The same properly is true if you are using a spatial join:

where table1.obj Intersects table2.obj
and table2.obj Intersects table3.obj
  • Well, that was it, thank you. The joining order matters. I am new to SQL commands so I was wondering is it always the case that the joining order matters? I mean also for tables (not geographical objects). For example, "where obj1.A = obj2.A and Obj3.B = Obj2.B" isn't the same as "where obj1.A = obj2.A and Obj2.B = Obj3.B" – Barbe Rouge Sep 11 '13 at 6:36
  • You just proved that it's important for spatial joins, and I know it's important for alfanumerical joins. That's however only the case when using the MapInfo Pro SQL language. – Peter Horsbøll Møller Sep 11 '13 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.