0

I have a dataset with parcels with a unique lotplan - lets say it has 10,000 records. I have a dataset which has owner info which has one or many owners for each lotplan lets say it has 11,0000 records. For example this would be an apartment complex or similar where there are many owners.

We need to join the parcels to owner by lotplan and where a single lotplan has multiple owners the lot plan spatial object should be repeated in the dataset for each.

So we should end up with a combined dataset of 11,000 records.

How can I do this in Mapbasic?

In QGIS I'd use Virtual Layers (Joining multiple records to single feature using QGIS?)

The brute force method maybe to rebuild the parcel table based on the owner info. So row by row go through the owner table by lotplan, find the spatial record in the parcel dataset, append it to a new table, fill in the fields based on the records in both datasets and then do the next one in the owner table. This will ensure one spatial object for each record in the owner dataset.

I hope I don't have to do the above and there's an easier way...

2

You should be able to do this using a standard join in MapInfo Pro:

In the MapBasic window you'd run a query like this:

Select *
From PARCELS, OWNERS
Where PARCELS.LOTPLAN = OWNERS.LOTPLAN

This should give you a resultset where each parcel appears as many times as there is owners with the same lot plan.

  • I had to then save the query as a tab file and then append it to the main table. Is there a way of doing this as part of the query? – GeorgeC Jul 26 '17 at 3:41
  • So you want to add the resulting query to the main table? You can basically insert the resulting query into the main table – Peter Horsbøll Møller Aug 1 '17 at 22:29

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.