语句1:
select t.mediid,t.mediname,t.showunit,sum(t.showquan) CalQuan,t.price,sum(t.amount) CalAmount
from amsh_mixdtl t
inner join amsh_mix mix on mix.ourid=t.mainid 
where mix.recipeid in(select ad.recipeid from out_sendmediaddress ad where ad.orderid is not null and ad.iscancel=0)
group by t.mediid,t.mediname,t.showunit,t.price;语句2:
select t.mediid,t.mediname,t.showunit,sum(t.showquan) CalQuan,t.price,sum(t.amount) CalAmount 
from amsh_mixdtl t 
inner join amsh_mix mix on mix.ourid=t.mainid 
where exists (select 1 from out_sendmediaddress ad where ad.orderid is not null and ad.iscancel=0 and mix.recipeid = ad.recipeid)
group by t.mediid,t.mediname,t.showunit,t.price;