Re: Help: MapInfo Update Query

787 views
Skip to first unread message

Richard Greenwood

unread,
May 22, 2013, 4:04:35 PM5/22/13
to Theudys Mejia, mapinfo-l
I am sorry to say that I have never found a way to update more than one column at a time in MapInfo. It seems like a most unfortunate shortcoming. I am cc'ing mapinfo-l in case there is a solution.

Best regards,
Rich


On Wed, May 22, 2013 at 9:45 AM, Theudys Mejia <theudy...@pisgahti.com> wrote:

Dear Richard Greenwood,

 

I am contacting you because I saw this post from 2/17/2008 on a Google forum asking how to query more than one column at the same time using MapInfo. Here is a copy of the post you made:

 

I would like to update more than one column with a single SQL
statement but it appears that MapInfo only allows updating one column
in a SQL statement. Am I correct about this? Can anyone suggest a work
around?

Thanks,
Rich

-- 
Richard Greenwood
richard....@gmail.com
www.greenwoodmap.com

 

I am trying to figure out how to do the same thing on MapInfo but I have yet to find an answer. I tried using the Update Column option under the Table tab and then tried the option Expression (see attached). However, in the text box I could not type more than a few characters. I would like to know, if you have already found an answer? And if yes, where do I exactly type the syntax to do the query? Please, if you have the time to assist me on this I would deeply appreciate it since I have tried but failed miserably.

 

Best regards,

 

Theudys Mejia

Engineer Assistant

EDS / Pisgah Telecommunications Inc.

Authorized FiOS Contractor for Verizon

(O) 718-993-3241

(F) 718-993-3486

(C) 646-260-2658

 




--
Richard Greenwood
richard....@gmail.com
www.greenwoodmap.com

Alan Carr

unread,
May 24, 2013, 6:37:49 AM5/24/13
to mapi...@googlegroups.com, Theudys Mejia
Hi Richard,

You need to know the column number of the unique identifier in both tables and run something like this:

Add Column TABLE1 (COL1)
From TABLE2
Set To COL1 where COL13 = COL13
Add Column TABLE1 (COL2)
From TABLE2
Set To COL2 where COL13 = COL13
Add Column TABLE1 (COL3)
From TABLE2
Set To COL3 where COL13 = COL13
Add Column TABLE1 (COL4)
From TABLE2
Set To COL4 where COL13 = COL13
Add Column TABLE1 (COL5)
From TABLE2
Set To COL5 where COL13 = COL13
Add Column TABLE1 (COL6)
From TABLE2
Set To COL6 where COL13 = COL13

Obviously replace Table1 with the table you are updating and Table2 with the table you are obtaining your values from. This is from a tool I did a couple of weeks ago, in this case Column 13 in both tables is the unique identifier. The tool was designed to update from an excel document with an identical table structure to the TAB file.

Hope his helps.

-Alan

Alan Carr

unread,
May 24, 2013, 9:27:21 AM5/24/13
to mapi...@googlegroups.com, Theudys Mejia
You will need to do it in the MapBasic window, I think all those commands work find without the need to compile a tool

On Friday, May 24, 2013 2:17:12 PM UTC+1, Theudys Mejia wrote:

Hello Alan,

I am using MapInfo Professional 7.8 and tried to do that update query under the tab Table>Update Column...>Assist... However, i keep getting the same error that the syntax is not right. I don't know if i should make a MapBasic Script or if i should use another options on MapInfo but i am really stuck. Or it is maybe that MapInfo 7.8 does not support those commands, and if not, what am i doing wrong? Please, if you have any other suggestions let me know. Thank you for your help.

Best Regards,
Theudys Mejia

Thomas Bacon

unread,
May 24, 2013, 9:41:54 AM5/24/13
to mapi...@googlegroups.com
Hi Theudys,
 
Open the MapBasic window and use the following template to update multiple columns:
 
Update TableName Set colName1 = Value1, colName2 = Value2, colName3 = Value3, etc...
 
A good idea to backup your data (or at the very least check the results before saving) before running an update like this.
 
Hope this helps,
 
Tom


From: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] On Behalf Of Theudys Mejia
Sent: 24 May 2013 14:17
To: mapi...@googlegroups.com
Cc: Theudys Mejia
Subject: [MI-L] Re: Help: MapInfo Update Query


Hello Alan,

I am using MapInfo Professional 7.8 and tried to do that update query under the tab Table>Update Column...>Assist... However, i keep getting the same error that the syntax is not right. I don't know if i should make a MapBasic Script or if i should use another options on MapInfo but i am really stuck. Or it is maybe that MapInfo 7.8 does not support those commands, and if not, what am i doing wrong? Please, if you have any other suggestions let me know. Thank you for your help.

Best Regards,
Theudys Mejia

On Friday, May 24, 2013 6:37:49 AM UTC-4, Alan Carr wrote:
Hi Richard,

You need to know the column number of the unique identifier in both tables and run something like this:

Add Column TABLE1 (COL1)
From TABLE2
Set To COL1 where COL13 = COL13
Add Column TABLE1 (COL2)
From TABLE2
Set To COL2 where COL13 = COL13
Add Column TABLE1 (COL3)
From TABLE2
Set To COL3 where COL13 = COL13
Add Column TABLE1 (COL4)
From TABLE2
Set To COL4 where COL13 = COL13
Add Column TABLE1 (COL5)
From TABLE2
Set To COL5 where COL13 = COL13
Add Column TABLE1 (COL6)
From TABLE2
Set To COL6 where COL13 = COL13

Obviously replace Table1 with the table you are updating and Table2 with the table you are obtaining your values from. This is from a tool I did a couple of weeks ago, in this case Column 13 in both tables is the unique identifier. The tool was designed to update from an excel document with an identical table structure to the TAB file.

Hope his helps.

-Alan

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en
 
---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


Mouchel logo

Mouchel Limited (Mouchel) is registered in England and Wales with registered number 01686040 at Export House, Cawsey Way, Woking, Surrey, UK, GU21 6QX.  The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. Any views or opinions expressed in this e-mail may be solely those of the author and are not necessarily those of Mouchel. No contracts may be concluded on behalf of Mouchel by means of email communications. Mouchel reserves the right to monitor and intercept emails sent and received on our network. 

Reply all
Reply to author
Forward
0 new messages