我的代码是这样的,但是第三行中的错误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');
我的代码是这样的,但是第三行中的错误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');
使用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'));