Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have two tables. Each table has a column with a reference number. Most of the records in these tables are the same but there are some which are in one table but not in the other.

How can I compare these columns and pick out the records which are only in one table?

I could write a MapBasic program that loops through each record and looks it up in the other table but I'm wondering if there is a simpler SQL-like way of doing this.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Let's say we have two tables: Tab1 with field Field1, Tab2 with field Field2.

We want to select records from Tab1 which Field1 values is not present in Field2 of Tab2.

In MapInfo: menu Query->SQL Select...

  • Columns: *
  • from Tables: Tab1
  • where Condition: not Field1 in (select Field2 from Tab2)

In MapBasic window it will be: Select * from Tab1 where not Field1 in (select Field2 from Tab2) into Selection

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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