Hi Christan,

the Problem is solved with Version 5.0.24, our Database is running stable
now :)

thx for help
greets
Michael

-----Ursprüngliche Nachricht-----
Von: Christian Hammers [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 24. August 2006 21:05
An: Michael Sordje; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Betreff: Re: Bug#383826: mysql Time-Sorting is not working

tags 383826 + unreproducible moreinfo upstream
stop

Hello Michael

On 2006-08-19 Michael Sordje wrote:
> Version: 5.0.22-4
At least in the 5.0.24-1 I've running here everything looks fine. If it does
not for you, please provide the complete "mysqldump" of your test table and
the output of the SELECT statements. (this is really important as I have
seen
problems that only occur when there was a NOT NULL or similar seemingly
unimportant differences).

> Fields: id (INT), starttime (DATETIME), runtime (INT)
Mine:


 mysql> SHOW CREATE TABLE t;
  CREATE TABLE `t` ( 
    `id` int(11) default NULL, 
    `starttime` datetime default NULL, 
    `runtime` int(11) default NULL
  ) ENGINE=MyISAM DEFAULT CHARSET=latin1

  INSERT INTO `t` VALUES (1,'2006-04-02 23:21:11',242);
  INSERT INTO `t` VALUES (2,'2006-04-04 13:21:11',142);
  INSERT INTO `t` VALUES (3,'2006-05-04 03:01:01',442);    
  INSERT INTO `t` VALUES (4,'2006-05-04 03:03:03',2);

Note that 3. begins earlier than 4. but ends after it (I guess that
was the case that did not work for you?)

> Works:
> 
> SELECT id FROM table ORDER BY (starttime+INTERVAL runtime SECOND) ASC

Works here, too:
 mysql> SELECT * FROM t ORDER BY (starttime+INTERVAL runtime SECOND) asc;
 +------+---------------------+---------+
 | id   | starttime           | runtime |
 +------+---------------------+---------+
 |    1 | 2006-04-02 23:21:11 |     242 | 
 |    2 | 2006-04-04 13:21:11 |     142 | 
 |    4 | 2006-05-04 03:03:03 |       2 | 
 |    3 | 2006-05-04 03:01:01 |     442 | 
 +------+---------------------+---------+

> Does not work:
> 
> SELECT id, (starttime+INTERVAL runtime SECOND) AS zeit FROM table ORDER BY
> (starttime+INTERVAL runtime SECOND) ASC

Works here!

 mysql> SELECT id, (starttime+INTERVAL runtime SECOND) as zeit FROM t 
             ORDER BY (starttime+INTERVAL runtime SECOND) asc;
 +------+---------------------+ 
 | id   | zeit                |
 +------+---------------------+
 |    1 | 2006-04-02 23:25:13 | 
 |    2 | 2006-04-04 13:23:33 | 
 |    4 | 2006-05-04 03:03:05 | 
 |    3 | 2006-05-04 03:08:23 | 
 +------+---------------------+

> Works:
> 
> SELECT id, (starttime+INTERVAL runtime SECOND) AS zeit FROM table ORDER BY
> zeit ASC

 mysql> SELECT id, (starttime+INTERVAL runtime SECOND) as zeit FROM t 
            ORDER BY zeit asc;
 +------+---------------------+
 | id   | zeit                |
 +------+---------------------+
 |    1 | 2006-04-02 23:25:13 | 
 |    2 | 2006-04-04 13:23:33 | 
 |    4 | 2006-05-04 03:03:05 | 
 |    3 | 2006-05-04 03:08:23 | 
 +------+---------------------+


bye,

-christian-


Reply via email to