① 按天、月做統計,需要每天的走勢變化。
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)
②待續…