MySQL Forums
Forum List  »  Quality Assurance

Wierd sorting bug?
Posted by: Franz Huber
Date: December 31, 2011 08:35AM

my MySQL Server (version: 5.0.51a-3ubuntu5.8) I have the following InnoDB table:

The following query produces wrong (wrongly sorted results):

SELECT id,kontostand FROM `kontostaende` WHERE konto = '1' ORDER BY id DESC LIMIT 5

It will show rows sorted ascending by id from id=1 to id=7.

If I change the query by doing any of the folloginw changes:
- "LIMIT 5" -> "LIMIT 6"
- remove "WHERE konto = '1'"
- remove column "kontostand"

the result will be rows sorted descending starting from "id=8".

What is wrong here?

Options: ReplyQuote

Written By
Wierd sorting bug?
December 31, 2011 08:35AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.