mysql group by 之后拿到最新的一条数据
SELECT sum(ProcessPrice),t2.ProductNO from (SELECT ProductNO ,ProcessNO, ProcessPrice,AddTime from productprocess) t2
join
(select ProductNO ,ProcessNO, max(AddTime) time
from productprocess GROUP BY ProductNO, ProcessNO) t1 on t2.ProductNO=t1.ProductNO
and t2.ProcessNO=t1.ProcessNO and t2.AddTime=t1.time GROUP BY t2.ProductNO