I'm fairly adept with the SQL Select in MapInfo, but I'm running into something that's got me a bit stumped.
I've got data in two tables that have a few columns in common. I want to join the tables
and export them to a CSV, but I don't want to duplicate those columns. Unfortunately, something like this doesn't work:
SELECT table1.*, table2.A, table2.B, table2,C
From table1, table2
Where table1.match = table2.match
Into table_merged`
Is there a way to accomplish this? If it helps, table2
will always have the same number of columns and the first five columns are present in table1
.
Best Answer
I see what you are asking for. Unfortunately the MapInfo SQL syntax doesn't support "tableA.*". You can only select all columns from both tables or specific columns.
I see three workarounds
Select all columns and then modify the table structure afterwards where you can remove the extra columns you don't want
If your table structure is somewhat static, you could create a SQL Select statement and save this to a SQL Select Template via the SQL Select dialog.
Via MapBasic you can figure out dynamically which columns to include and from this create a SQL statement only including the necessary columns in your SQL statement.
'----
On the Pitney Bowes Ideas Portal a wish similar to your exists, give it a like: http://ideas.pb.com/ideaView?id=08780000000E75VAAS