List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:March 10 2000 1:56am
Subject:major problems with mysql
View as plain text  
Hi!

While scanning old mails, I come across the following:

>>>>> "Kiyanosh" == Kiyanosh Kamdar <kenk@stripped> writes:

Kiyanosh> Hello,
Kiyanosh>   I have been having many problems with mysql.  I am now having problems
Kiyanosh> with the order by.  Here are the details, try it out and tell me if it
Kiyanosh> is messed up.  I am wondering if our administrator did not build it
Kiyanosh> properly.

Kiyanosh> mysql  Ver 9.37 Distrib 3.22.29, for sun-solaris2.6 (sparc)

<cut>

Kiyanosh> create table  stuff (
Kiyanosh>     bit bigint not null,
Kiyanosh>     name varchar(255) not null,
Kiyanosh>     description text not null,
Kiyanosh>     isbuggroup tinyint not null,
Kiyanosh>     userregexp tinytext not null,
Kiyanosh>     unique(bit)
Kiyanosh> );

Kiyanosh> insert into stuff (bit,name) values (1,"group1");
Kiyanosh> insert into stuff (bit,name) values (2,"group2");
Kiyanosh> insert into stuff (bit,name) values (4,"group3");
Kiyanosh> insert into stuff (bit,name) values (8,"group4");
Kiyanosh> insert into stuff (bit,name) values (16,"group5");
Kiyanosh> insert into stuff (bit,name) values (32,"group6");
Kiyanosh> insert into stuff (bit,name) values (64,"group7");
Kiyanosh> insert into stuff (bit,name) values (256,"group8");
Kiyanosh> insert into stuff (bit,name) values (128,"group9");

Kiyanosh> now if you do a select it doesn't order bit 128 properly it puts it
Kiyanosh> BEFORE bit 64

Kiyanosh> select * from groups;

Kiyanosh> If you try and use the order field it outputs this:

Kiyanosh> select * from groups order by bit;

Kiyanosh> bit  | name
Kiyanosh> -----------
Kiyanosh> 128 group9
Kiyanosh> 256 group8
Kiyanosh> 1 group1
Kiyanosh> 2 group2
Kiyanosh> 4 group3
Kiyanosh> 8 group4
Kiyanosh> 16 group5
Kiyanosh> 32 group6
Kiyanosh> 64 group7

First: The above isn't a real example that shows the problem, as you don't
have any table named 'groups'  Next time, please do an exact copy and
paste of your problem!

I don't have this problem, at least not with MySQL 3.22.32 or 
MySQL 3.23.12 on Solaris 2.6:

mysql> select * from stuff order by bit;
+-----+--------+-------------+------------+------------+
| bit | name   | description | isbuggroup | userregexp |
+-----+--------+-------------+------------+------------+
|   1 | group1 |             |          0 |            |
|   2 | group2 |             |          0 |            |
|   4 | group3 |             |          0 |            |
|   8 | group4 |             |          0 |            |
|  16 | group5 |             |          0 |            |
|  32 | group6 |             |          0 |            |
|  64 | group7 |             |          0 |            |
| 128 | group9 |             |          0 |            |
| 256 | group8 |             |          0 |            |
+-----+--------+-------------+------------+------------+
9 rows in set (0.38 sec)

Regards,
Monty
Thread
major problems with mysqlKiyanosh Kamdar19 Jan
  • Re: major problems with mysqlsasha19 Jan
  • major problems with mysqlMichael Widenius10 Mar