K
kaida
Unregistered / Unconfirmed
GUEST, unregistred user!
select t1.名稱,t1.日期,t1.數量,t1.審核,
(select sum(數量) from 表名 t2 where t2.日期<t1.日期 and t2.名稱=t1.名稱 and t2.審核='Y' GROUP BY t2.名稱,t2.日期 ) as 累計
from 表名 t1
(select sum(數量) from 表名 t2 where t2.日期<t1.日期 and t2.名稱=t1.名稱 and t2.審核='Y' GROUP BY t2.名稱,t2.日期 ) as 累計
from 表名 t1