VERIFIED SOLUTION i
X

Deleting duplicate records and retaining map objects in MapInfo Pro using SQL Queries

UPDATED: December 3, 2018


This is the original procedure to remove duplicates and retain map objects.
MapInfo Pro now ships with an easy to use tool to do the operation.


The following procedure will produce a final table with map objects and no duplicate records .

Start with the table that has the duplicate records. Choose Table>Maintenance>Table Structure and add a field to the table. Call it Row_Number for example.
Make sure it is of type Integer.

Next, go to Table>Update Column and update the column with RowID.

User-added image

Next, go to Query>SQL Select. Select the table from the Table dropdown and then click in the Group by Columns field and select a column from the Column dropdown .

User-added image

Click OK and a Query1 browser will be returned. Choose File>Save Copy As and select Query1 and click Save As. Rename the Query1 table with a more meaningful name and click save. For this example, it will be called GroupedTable.

Choose File>Close Table and close the Query1 table. Choose File>Open Table and open the new
GroupedTable.

It should open as a browser and have no map associated with it. Next, choose Query>SQL Select.
From the Table dropdown, select the original table first, then select the grouped table as shown below. In the where Condition, join the two tables on the Row_number column.

User-added image

Choose File>Save Copy as and select the current Query# and then rename the Query to another name. Click Save.

Choose File>Close Table and close the query. Choose File>Open Table and open the copy that was just saved. This is the final version of the table.

The map objects will now be restored and the duplicate rows will be gone.

Downloads

  • No Downloads