① 按天、月做统计,需要每天的走势变化。
sql查询到每天(每月)的值为之前所有值的和
实现如下: 通过op_time与a.op_time比较实现

select DAY(op_time),(select sum(price) from t_margin_profit where day(op_time)<=day(a.op_time) 
and year(op_time) = '2016' and month(op_time) = '1') 
from
    t_margin_profit a where year(op_time) = '2016' and month(op_time) = '1' 
    GROUP BY DAY(op_time)

②待续…