我的代码是这样但第三行mm/dd/yyyy
的错误我的数据库日期格式是这样的:
SELECT
evep
year(date='MM/dd/yyyy'),
month(date='MM/dd/yyyy'),
Avg(evep)
FROM
Value
GROUP BY
evep,
year(date='MM/dd/yyyy'),
month(date='MM/dd/yyyy');
答案 0 :(得分:0)
使用STR_TO_DATE()将日期字符串转换为实际日期
SELECT
evep,
year(str_to_date(date, '%m/%d/%Y')),
month(str_to_date(date, '%m/%d/%Y')),
Avg(evep)
FROM
Value
GROUP BY
evep,
year(str_to_date(date, '%m/%d/%Y')),
month(str_to_date(date, '%m/%d/%Y'));