1、创建
create view v (pdate,goodsId,productionId,qty)列名 as select p.pdate,p.goodsId,p.productionId,sum(p.qty) from t_production p group by p.pdate,p.goodsId,p.productionId;
2、使用
select * from v where v.pdate=pdate;
1、创建
create view v (pdate,goodsId,productionId,qty)列名 as select p.pdate,p.goodsId,p.productionId,sum(p.qty) from t_production p group by p.pdate,p.goodsId,p.productionId;
2、使用
select * from v where v.pdate=pdate;