List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 2 2001 3:53pm
Subject:Re: Hazardous problem making arithmetic operation on date fields.
View as plain text  
At 5:22 PM +0200 10/2/01, Malko Malko wrote:
>>Description:
>        When multiplying a date field with a number( any type ) field 
>for some values in any of these 2 fields mysql did nt answer to 
>queries.
>>How-To-Repeat:
>#
># Table structure for table 'testdate'
>#
>
>CREATE TABLE testdate (
>   ID int(11) NOT NULL auto_increment,
>   DATE time DEFAULT '00:00:00' NOT NULL,
>   coef decimal(4,2) DEFAULT '0.00' NOT NULL,
>   PRIMARY KEY (ID)
>);
>
>#
># Dumping data for table 'testdate'
>#
>
>INSERT INTO testdate VALUES( '1', '15:54:52', '0.75');
>INSERT INTO testdate VALUES( '2', '00:17:21', '0.75');
>INSERT INTO testdate VALUES( '3', '00:10:00', '0.75');
>
>when executing this query :
>mysql> select date,coef,sec_to_time(time_to_sec(date*coef)) from testdate;

Don't you mean

sec_to_time(time_to_sec(date)*coef)

instead?

>+----------+------+-------------------------------------+
>| date     | coef | sec_to_time(time_to_sec(date*coef)) |
>+----------+------+-------------------------------------+
>| 15:54:52 | 0.75 | NULL                                |
>| 00:17:21 | 0.75 | NULL                                |
>| 00:10:00 | 0.75 | 00:07:50                            |
>+----------+------+-------------------------------------+
>3 rows in set (0.00 sec)
>


-- 
Paul DuBois, paul@stripped
Thread
Hazardous problem making arithmetic operation on date fields.Malko Malko2 Oct
  • Re: Hazardous problem making arithmetic operation on date fields.Carl Troein2 Oct
  • Re: Hazardous problem making arithmetic operation on date fields.Paul DuBois2 Oct