Easy one for you 'rowid'

1,149 views
Skip to first unread message

Mark

unread,
Nov 5, 2008, 1:22:09 PM11/5/08
to MapInfo-L
Never had a need to do this before, when you update a cloum with
'rowid' mapinfo updates the rows 1,2,3,4 etc.

However i need it to do the opposite, count down i.e 4,3,2,1

Cheers people

Mark

Uffe Kousgaard

unread,
Nov 5, 2008, 1:45:33 PM11/5/08
to mapi...@googlegroups.com
How about update with 5-rowid ?

Mark

unread,
Nov 5, 2008, 2:08:16 PM11/5/08
to MapInfo-L
Does that do the opposite to 'rowid' then ?

I could manually type it in, only if i had 5 rows to number, however i
need it to update the column decending instead of ascending ?

Any help would be great

Lars I. Nielsen (GisPro)

unread,
Nov 5, 2008, 2:46:50 PM11/5/08
to mapi...@googlegroups.com
Hi Mark,

A relational data set isn't technically sorted unless you sort it. If you want a specific sorting, issue an SQL select with a sorting sub clause. In Pro that's done using the "SQL" dialog.

If you want to assign rowids in a descending order to a table, you need to first sort your _data_ descending, by whatever column you want, and then update the _query_ with ROWID.

Example:
    Select * From YourTable Order By PostCode Desc Into Q1
    Update Q1 Set MyID = ROWID

That'll give the highest PostCode the lowest ID.

Best regards / Med venlig hilsen
Lars I. Nielsen
GIS & DB Integrator
GisPro


Mark skrev:

Peter Horsbøll Møller

unread,
Nov 5, 2008, 2:55:04 PM11/5/08
to mapi...@googlegroups.com
Mark,
 
How about this:
 
Update MYTABLE
   Set ID = (TableInfo("MYTABLE", 8) - (ROWID - 1))
TableInfo("MYTABLE", 8) will return the number of rows in your table.
You could also insert this value as the number itself. Just browse the table and you can see the number of rows/records in the statusbar.
 
Peter Horsbøll Møller
Reply all
Reply to author
Forward
0 new messages