I have a query like this:
SELECT COUNT(*) AS amount FROM daily_individual_tracking WHERE sales = \'YES\' AND daily_individual_tracking_date BETWEEN \'2010-01
You can use the MySQL datediff function:
datediff
SELECT DATEDIFF('2010-01-01','2010-01-31') AS DiffDays
It should return a floating point, where 1.0 represents a single day.
1.0
And for MS SQL use ,
SELECT DATEDIFF( day ,'2010-01-01','2010-01-31') AS DiffDays