Average in mysql with date
I am working on Averaging multiple series of data, and I debunked my onset by figuring it out, and I "think" "I am up to the last mistake."
ERROR 1584 (42000): Incorrect parameters in the call to stored function 'cast'
I get this when I run this
select avg(volume) from _AAPL WHERE date between cast('2014-02-03' as date) and cast ('2014-05-05' as DATE);
_AAPL is my table, date is my column "date", dates are already in the database under "date"
I can't get rid of this error, any ideas?
+3
source to share
3 answers
IN mysqlyou can convert string literal to date with function str_to_date
:
SELECT AVG(volume)
FROM _AAPL
WHERE `date` BETWEEN STR_TO_DATE ('2014-02-03', '%Y-%m-%d') AND
STR_TO_DATE ('2014-05-05', '%Y-%m-%d')
+1
source to share