New to the GIS forum so apologies in advance for any potential etiquette failures...

I'm working in MapInfo. I have multiple tables with the same structure. One of my columns is pipe diameter. I would like to do an SQL select for a particular pipe diameter or range of diameters i.e. 5m<= x <=10m across all the tables. Is this possible?

I am able to do it for one table and save the data into a new table file, then redo this using a Mapbasic script however, I then end up with lots of individual tables. I could do this and then copy and paste between the tabs however the data is very large so this is time consuming. Using the SQL tool, is it possible to select data from a particular column which reoccurs in multiple tables, and create a group selection across multiple tables which can be saved into a single table?

Feel free to ask any questions

  • is it ok for you to try to join all tables into one ? you said that structure is EXACTLY the same for all tables.
    – sys49152
    Commented Dec 22, 2014 at 13:39
  • Tengo dos tablas, una con area y otra con contenido de la area, quiero hacer un layout para imprimir mi imagen pero dejar los objetos contenidos en una sola tabla , no recuerdo como usar el select contains , gracias Commented Nov 10, 2016 at 18:50
  • This is not an answer but another question, please create a question to get help with your issue.
    – GeoSharp
    Commented Nov 10, 2016 at 19:34

1 Answer 1


in sql you can write something like this :

SELECT * FROM  x where pipedn >= 5 AND pipedn <= 10 


SELECT * FROM table x WHERE pipedn BETWEEN 5 AND 10

these examples show howto use WHERE

if all your tables are same you can do:

SELECT col1, col2 from  x UNION ALL SELECT col1 , col2 from table y 

this one select two table x and y and creates one results set , you can also SELECT INTO this to new table which then contains x and y table

see: http://msdn.microsoft.com/en-us/library/ms180026.aspx

You can create new table all_data

CREATE TABLE all_data AS (SELECT id , data from x UNION ALL SELECT id, moredata as data from y)

for example http://www.techonthenet.com/sql/index.php seems to have quite good tutorial for basic SQL commands

edit: You can do something like this too

SELECT * from table_data x where x.col1 > 3 

table_data x creates alias x for table_data table name, so only thing you need to change between queries is table name. Howto do this in MapInfo , i dont know. Above is just simple SQL

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.