Disorder result using ORDER BY with ENUM, INT

"Kriengkrai J." <[email protected]>
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>
-- 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
-- --
-- +----+---------+
-- | id | type    |
-- +----+---------+
-- |  1 | general |
-- |  2 | general |
-- |  3 | general |
-- |  4 | general |
-- |  5 | inhouse |
-- |  6 | inhouse |
-- ..
-- 3. After running statement(2) I rerun statement(1) again and the result is then in order as (2).
-- 
-- Dummy data & structure for testing is dumped as shown below.
-- Thank you,
--
-- -kk-
-- 2003/11/26
--
-- MySQL dump 9.09
--
-- Host: localhost    Database: test
-- ------------------------------------------------------
-- Server version	4.0.16

--
-- Table structure for table `report`
--

CREATE TABLE report (
  id int(10) unsigned NOT NULL default '0',
  type enum('general','inhouse') NOT NULL default 'general',
  PRIMARY KEY  (id)
) TYPE=MyISAM COMMENT='Available Reports';

--
-- Dumping data for table `report`
--

INSERT INTO report VALUES (1,'general');
INSERT INTO report VALUES (2,'general');
INSERT INTO report VALUES (3,'general');
INSERT INTO report VALUES (4,'general');
INSERT INTO report VALUES (5,'inhouse');
INSERT INTO report VALUES (6,'inhouse');
INSERT INTO report VALUES (7,'inhouse');
INSERT INTO report VALUES (8,'inhouse');
INSERT INTO report VALUES (9,'inhouse');
INSERT INTO report VALUES (10,'inhouse');
INSERT INTO report VALUES (11,'inhouse');
INSERT INTO report VALUES (12,'inhouse');
INSERT INTO report VALUES (13,'inhouse');
INSERT INTO report VALUES (14,'inhouse');

-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.