Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含日期、距离和 TimeForDistance 的表...
有没有办法使用 MySQL 语句计算平均每月速度?
任何帮助将不胜感激!
我想你正在寻找这样的东西:
SELECT YEAR(my_date) as my_year, MONTH(my_date) as my_month, sum(Distance) / sum(TimeForDistance) AS velocity FROM your_table GROUP BY my_year, my_month ORDER BY my_year, my_month