我想知道是否有人可以建议在MySQL设置或查询本身方面的任何改进,以减少运行时间。我们只有大约8个大的member_id有这个性能问题,其余的运行在5秒内。我们运行多个这样的汇总表,用于汇总报告。select * SELECT distinct account_name AS source,SUM(royalty_amount) AS total_amount AND period_year_quarter >= '2016_Q1&
我是MySQL的新手,有这个理论问题给我。SELECT c.id, c.name AS customer_name, c.country , SUM(d.price) AS total_priceJOIN customers_order_detailsd GROUP BY customer_name, ORDER BY total_priceDESC;
但是,我很难理解如何按AssignmentID对工作会话进行分组,然后将所有TimeSpent列SUM()在一起,从而得出总的总数。SUM( TIMESTAMPDIFF(second, t1.StartTime, t1.EndTime) ) AS TimeSpent LEFTJOIN assignment t2 ON t1.AssignmentID = t2.AssignmentID
LEFT JOIN module t3 ON t2