表结构为:(materiel)物料种类,supply(供应商)、period(期数1、2、3….)、物料数量(Tare) 
假设本期为2,要从此表中查出如下视图   物料种类、供应商、本期数量、上期数量、累计数量 
请问该如何写SQL语句 ---select materiel,
       supply,
       本期数量 = tare,
       上期数量 = (select tare from Ta where materiel = a.materiel and supply = a.supply and period = a.period - 1),
       累计数量 =  tare+ (select tare from Ta where materiel = a.materiel and supply = a.supply and period = a.period - 1)
from ta a
where period = 2