Alternatively, you could try something like this :

SET @rownum = 0;
SELECT @rownum := @rownum + 1 AS rownumber_column, 
       some_real_columnnames
FROM  your_table 
LIMIT 100

-----Original Message-----
From: Clyde Lewis [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 25, 2006 3:14 PM
To: [EMAIL PROTECTED]
Cc: MySQL List
Subject: Re: Show row number


Excellent explanation. Thanks again.

CL

At 02:00 PM 1/25/2006, [EMAIL PROTECTED] wrote:


>Clyde Lewis <[EMAIL PROTECTED]> wrote on 01/25/2006 01:41:30 PM:
>
> >   Is there a command in mysql that will return the row number. I
> > tried rownum and rownum()
> >
>
>No, "rows" do not exist in the base data of a MySQL database. They 
>are called "records" and records may be stored in any order. Within 
>some MySQL storage engines (particularly InnoDB), more than one of 
>any "record" may exist in the database at the same time (depending 
>on transaction activity) or in more than one place (NDB).
>
>Within the results of a SELECT query, the individual row number is 
>only important to the client. You need to use whatever number your 
>client library provides for you.( ex: in ADO you would use the 
>Recordset.AbsolutePosition property)  There is no internal "record 
>number" that is exposed through any interface to any client.
>
>Now, there is a pointer to each record but that is not useful 
>information to any system except the database server itself and 
>cannot be used to query for a particular record because it is not 
>part of the data but it is  part of the metadata associated with 
>each record. Records can move around within a database file 
>(changing their pointers) so long as the data pointed to does not change.
>
>Shawn Green
>Database Administrator
>Unimin Corporation - Spruce Pine

***********************
Clyde Lewis
Database Administrator
General Parts, Inc.
919-227-5100

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to