Re: Disorder result using ORDER BY with ENUM, INT
Alexander Keremidarski <[email protected]>
| Newsgroups | gmane.comp.db.mysql.bugs |
|---|---|
| Organization | MySQL AB |
| Message-ID | <[email protected]> |
Hi,
So far nobody was able to repeat your observation.
Can you prepare repeatable test case containgin ddata enough to repeat the
problem on another server?
Kriengkrai J. wrote:
> -- System: MySQL 4.0.13, 4.0.16 on Linux x86
> -- Table type: MyISAM, InnoDB
> -- Description / How-To-Repeat:
> -- 1. When I use
> -- SELECT id, type FROM test.report ORDER BY type, id;
> -- the result is in wrong order
> -- --
> -- +----+---------+
> -- | id | type |
> -- +----+---------+
> -- | 4 | general |
> -- | 3 | general |
> -- | 1 | general |
> -- | 2 | general |
> -- | 5 | inhouse |
> -- | 6 | inhouse |
> -- ..
> -- --
> -- 2. But when I use
> -- SELECT id, type FROM test.report ORDER BY type AND id;
> -- the result is in right order
I doubt you can define "right" order in this case
according to MySQL Boolean logic expression (type AND id) is evaluated to 1 =
True or 0 = False
All values of column `type` in your example has numeric represenyayion of 0 so
(type AND id) will be always false.
In other words:
SELECT id, type FROM test.report ORDER BY type AND id;
is equivalent to:
SELECT id, type FROM test.report ORDER BY 0;
which does not make much sense.
> -- 3. After running statement(2) I rerun statement(1) again and the result is then in order as (2).
Can you elaborate more on this?
Best regards
--
Are you MySQL certified? -> http://www.mysql.com/certification
For technical support contracts, visit https://order.mysql.com/?ref=msal
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Alexander Keremidarski <[email protected]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer
/_/ /_/\_, /___/\___\_\___/ Sofia, Bulgaria
<___/ www.mysql.com
--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/[email protected]