MySql DateDiff Query
Posted on 2011-03-12
I'm working on a Mysql Query as follows
SELECT `Symbol` , `Date` , `AdjClose` , `Strike` , `Type` , (
`Bid` + `Ask`
) /2 AS `Price` , DATEDIFF( 'Expiration', 'Date' ) AS 'Days'
FROM `IWM`.`OptionData` AS `OptionData`
WHERE `AdjClose` - `Strike` < '10'
AND `AdjClose` - `Strike` > '-10'
ORDER BY `Days` DESC
LIMIT 0 , 30
The Problem here is that DateDiff() should Take the difference from the two fields in the table and return the days between the two dates, at least as far as I know, but it only returns NULL.
What do I need to do to return a feild that is the number of days between these two date fields.