Stefan and Paul, When adding ORDER BY counterid, all rows are sorted correctly, but it should not be needed. All the other tables are sorted correctly at the start, and has always been.
This is the structure of the ID field in the second and third table: Field Type Null Key Default Extra ============================================= counterid mediumint(8) unsigned PRI 0 Structure of the ID field in the table with AUTO_INCREMENT (first table): Field Type Null Key Default Extra ============================================ counterid mediumint(8) unsigned PRI NULL auto_increment Regards, Viktor Vasiliou ----- Original Message ----- From: Paul DuBois To: Viktor Vasiliou ; Stefan Hinz Cc: [EMAIL PROTECTED] Sent: Thursday, February 13, 2003 10:23 PM Subject: Re: Strange sorting in table At 19:55 +0100 2/13/03, Viktor Vasiliou wrote: >Hi Stefan, > >Thanks for your reply! > >The table has just been created, and has therefore no deleted >entries. ID 1-1000 was created by myself, ID 1002 was created when a >new user registered at the website. ID 1001, 1003, 1004, etc is >sorted correctly. > >There is three tables in the database which all get a new row when a >user signup. First, an entry is created in "tblmembers" (using >auto_increment). After that, an entry is created in two other tables >(using mysql_insert_id to set the right ID in the primary key >columns). > >Any idea? The information you provide here doesn't really address Stefan's suggestion at all. Are you retrieving the values using a SELECT statement that include an ORDER BY ID clause? If not, add one and see if that solves the problem. If you are, then is your AUTO_INCREMENT column an integer column (not a CHAR or VARCHAR or something other than integer)? If it is an integer column, then let's see the structure of your table. > > >Regards, >Viktor Vasiliou > > >----- Original Message ----- >From: Stefan Hinz >To: Viktor Vasiliou >Cc: [EMAIL PROTECTED] >Sent: Wednesday, February 12, 2003 3:34 PM >Subject: Re: Strange sorting in table > > >Viktor, > >> I have a couple of tables in a MySQL database. In one of the tables, >> PhpMyAdmin sorts very strange. ID 1002 is places between ID 21 and >> ID 22. Any idea why? > >Have a look at the table structure. You will find 'ID' is an >AUTO_INCREMENT column. When entries are deleted, they leave "gaps". >These gaps are filled with records newly entered. So what you see is >the physical order. If you want another sort order, you could issue >"... ORDER BY ID". > >Details: http://www.mysql.com/doc/en/CREATE_TABLE.html > >Regards, >-- > Stefan Hinz <[EMAIL PROTECTED]> > iConnect GmbH <http://iConnect.de> > Heesestr. 6, 12169 Berlin (Germany) > Telefon: +49 30 7970948-0 Fax: +49 30 7970948-3 --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php