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.

1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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