商务合作:179001057@qq.com

最初学习是所写SQL语句

技术2022-05-11  1


某平台价值19860元的编程课程资料免费领取【点我领取】


declare cursor c2 is select goodsid,sum(amount) amount from t_bill_detail  where exists (select bseqid from t_bill_header where billtypeid=12) group by goodsid;      begin          delete from t_temp_sale;          for t2 in c2 loop              insert into t_temp_sale (goodsid,amount) values(t2.goodsid,t2.amount);          end loop;end;/     

内嵌视图:

select  t.goodsid,t.name,t.spec,t.factory,h.amount    from (select a.goodsid,sum(amount) amount        from t_bill_detail a where exists(select bseqid from t_bill_header where billtypeid=12 and a.bseqid=bseqid) group by(a.goodsid)) h,   t_goods_info t where t.goodsid=h.goodsid;


最新回复(0)