mysql 5.0.37....datediff... problem | | Nope, here is layout.
DROP TABLE IF EXISTS `date_test`;
CREATE TABLE `date_test` (
`id` int(4) unsigned zerofill NOT NULL auto_increment,
`date_start` date NOT NULL default '0000-00-00',
`date_end` date NOT NULL default '0000-00-00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Jerry Stuckle wrote:
> zoilus wrote:
>
>> Why am I getting null value results? Anyone.
>>
>> select DATEDIFF(date_start,date_end) from date_test;
>>
>> result set
>>
>> null
>> null
>> null
>> null
>>
>> data
>> id date_start date_end
>> 1 2004-02-00 2006-02-00
>> 2 2004-02-00 2006-02-00
>> 3 2006-02-00 2008-02-00
>> 4 2004-02-00 2006-02-00
>> 5 2006-02-00 2008-02-00
>> 6 2004-02-00 2006-02-00
>> 7 2006-02-00 2008-02-00
>> 8 2004-02-00 2006-02-00
>> 9 2006-02-00 2008-02-00
>> 10 2004-02-00 2006-02-00
>> 11 2006-02-00 2008-02-00
>
>
> Just a guess - but maybe date_start and date_end are not DATE types?
> They sure don't look like good dates. Maybe they are CHAR or VARCHAR
> instead?
>
> |