List:General Discussion« Previous MessageNext Message »
From:Jigal van Hemert Date:June 18 2005 5:55am
Subject:Re: Ordinal number within a table
View as plain text  
From: "Ed Reed"

> Is there way to return the ordinal position of a value within a table?
>
> Let's say I have a table of phone numbers. Over time the table has had
additions and deletions. The table has an autonumber ID field. If I sort by
the ID field I'd like to know what position the number '555-1212' is in the
table.

I'm not sure why you'd want to know this, but it's generally a good idea to
abandon the thought that records in a database are stored in a certain order
with a position number attached to them.

The internal way of storing data differs from engine to engine and you can
never be sure that these internals will not be modified in newer releases of
MySQL.

It's best to think of a table as a collection of records which can be
presented in the way you want. The way the database decides to store the
data is in many cases not relevant at all; that's the job of the database.

Regards, Jigal.

Thread
Ordinal number within a tableEd Reed18 Jun
  • Re: Ordinal number within a tableDan Nelson18 Jun
  • Re: Ordinal number within a tableJigal van Hemert18 Jun
    • Re: Ordinal number within a tablemfatene18 Jun
Re: Ordinal number within a tableNishikant Kapoor28 Jun
  • Re: Ordinal number within a tablemfatene28 Jun
RE: Ordinal number within a tableNishikant Kapoor28 Jun
  • RE: Ordinal number within a tablemfatene28 Jun
    • Re: Ordinal number within a tableMichael Stassen29 Jun
      • Re: Ordinal number within a tableMathias29 Jun