Lively discussions on the graphic arts and publishing — in print or on the web

Go Back   Desktop Publishing Forum > General Discussions > Web Site Building & Maintenance

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 05-30-2006, 12:02 AM   #1
iamback's Avatar
Join Date: Oct 2005
Location: Amsterdam, NL
Posts: 4,894
Default Weird MySQL problem

I'm running into a problem with MySQL that has me stumped. I cannot find anything about this behavior on the MySQL site either.

I have a table defined with one (string) column, and a PRIMARY key on that column (so each value must also be unique). Now assume I have the following records:
  • bbbbb
  • eeeee
  • pfffft

Next, I change one value, let's say I change "eeeee" to "zzzzz". If I subsequently do a SELECT without an ORDER BY clause, what I would expect is this:
  • bbbbb
  • zzzzz
  • pfffft
Instead, what I get is this:
  • bbbbb
  • pfffft
  • zzzzz

It seems MySQL implicitly sorts by the (primary) key, even if this is not specified with an ORDER BY clause. I cannot find a specification of this behavior.

Unfortunately - for a maintenance form of the table - I actually need to retrieve the records in the same order after a modification, regardless of what strings the column contains. The only workaround I can think of is to add an (otherwise redundant) auto_increment primary key, and define a second key on the actual data column as UNIQUE. This will work, but I'm not fond of adding redundant data...

Any other ideas, anyone?

Marjolein Katsma
Look through my eyes on Cultural Surfaces (soon!), My ArtFlakes shop and Flickr.
Occasionally I am also connecting online dots... and sometimes you can follow me on Marjolein's Travel Blog
iamback is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird hardware/router problem? LoisWakeman Web Site Building & Maintenance 14 03-16-2007 10:15 AM
PHP5x -> MySQL 5 Stored Procedure Problem LenHewitt Web Site Building & Maintenance 2 12-18-2006 03:07 PM
weird CSS problem in IE6 dacoyle Web Site Building & Maintenance 12 01-26-2006 06:18 PM
Help! PHP/MySQL problem annc Web Site Building & Maintenance 14 07-15-2005 12:09 PM

All times are GMT -8. The time now is 05:40 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Contents copyright 2004–2018 Desktop Publishing Forum and its members.