I guess I know the core answer from the start, that there is no direct way to reference different ROWIDs within an update table instruction. It would be nice but it ain't so.

Nonetheless, Robert Crossley posted a solution using copies of tables and joins:

1. You could add two columns to the table (eg. CurRowID and PrevRowID) and update these with its rowID and RowID - 1,
3. Then make a selection of the whole table into a query name
4. then update the table by joining the table to this query using CurRowID = PrevRowID to add the column z to that table as a temporary column.
5. The do the update as you suggested.


And Steve Wallace suggest the MapBasic approach of just looping through the table, storing prior values, and updating into the next.

Thanks Steve and Robert......

Declan


You could do this in MapBasic, looping thru the rows and storing the prior
row's values and update into the next. There is no way to do this in native
MapInfo.

-- Steve

-----Original Message-----
From: Declan Troy [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 05, 2003 02:33 PM
To: Mapinfo-L
Subject: MI-L MI-L: Update Column Based on Value in Different Row


Not sure if this is possible or just a syntax issue. Is there a way to update a column using a value in a different row.

Something to the effect of update mytable set X = Y + Z(ROWID-1)

Any suggestions?

declan

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 9039


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 9076



Reply via email to