Actually, unless MI did something to its SQL, the original statement is valid.
However,
if that does not work, try these.
update <table> set <col>=<val>
where <otherCol> in ( setval1, setval2.... setValn );
if there are too many rows to work on, you can use a subquery:
update selection set target_custs = tot_custs
where target_custs in (
select * from tblPostDist
where tot_custs > target_custs );
You may have to put in the table name as well:
update selection set selection.target_custs = tot_custs
where selection.target_custs in (
select * from tblPostDist
where tblPostDist.tot_custs > target_custs );
or whatever tables you are using.
2001-11-21 09:28:33, "Campbell, Keith A" <[EMAIL PROTECTED]> wrote:
>Andrew,
>
>Unfortunately you can't use the update statement with the syntax you've
>used. The only 'where' that is valid with the update statement is 'where
>RowID = x' which allows you to update one row only. Otherwise the update
>statement should have no where clause, in which case all rows in the tables
>will be updated. Not what you want in this case.
>
>The workaround is to do a select first, then update the Selection table:-
>
> Select * from tblPostDist where tot_custs > target_custs
>
> Update Selection set target_custs = tot_custs
>
>Keith
>
>-----Original Message-----
>From: Andrew Whittam [mailto:[EMAIL PROTECTED]]
>Sent: 21 November 2001 14:40
>To: '[EMAIL PROTECTED]'
>Subject: MI-L Update query in MI
>
>
>Hi - I'm sure that this has been covered loads of times but I can't find any
>record of it.
>
>I want to update a table on the basis of a condition i.e. (in SQL terms)
>
> update tblPostDist
> set target_custs=tot_custs
> where tot_custs>target_custs
>
>I can't see any way of issuing the where condition, I've tried typing the
>above code into the MapBasic window and the response was something like
>"unable to update target_custs"
>
>Any help/ideas/note of limitations is appreciated.
>
>Cheers - Andrew
>
>_________________
>Andrew Whittam
>Senior Business Analyst
>Tel: 020-7349 4087
>Fax: 020-7349 4001
>
>
>
>_______________________________________________________________________
>List hosting provided by Directions Magazine | www.directionsmag.com |
>To unsubscribe, send e-mail to [EMAIL PROTECTED] and
>put "unsubscribe MapInfo-L" in the message body.
>
>
>This email and any attached files are confidential and copyright protected.
>If you are not the addressee, any dissemination of this communication is
>strictly prohibited. Unless otherwise expressly agreed in writing, nothing
>stated in this communication shall be legally binding.
>
>
>
>
>_______________________________________________________________________
>List hosting provided by Directions Magazine | www.directionsmag.com |
>To unsubscribe, send e-mail to [EMAIL PROTECTED] and
>put "unsubscribe MapInfo-L" in the message body.
>
Ryan Shuya
GIS Divison
Traxis Inc.
Saskatoon, SK.
(306) 978-0445
[EMAIL PROTECTED]
_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.