Select @PriceTypeid=isnull(PriceTypeid,'') From BtypeDistributeview where Branchid=@Branchid and Type=0
select sum(case when pricetypeid = @PriceTypeid then price else 0 end) as stockprice,
sum( case when pricetypeid = 'LSSJ1' then price else 0 end) as relprice
from posptypeview a
left join PosPtypePriceView b on a.ptypeid = b.ptypeid
where a.ptypeid = @Ptypeid and b.pricetypeid in(@PriceTypeid,'LSSJ1')
Select @PriceTypeid=isnull(PriceTypeid,'') From BtypeDistribute where Branchid=@Branchid and Type=0
select sum(case when pricetypeid = @PriceTypeid then price else 0 end) as stockprice,
sum( case when pricetypeid = 'LSSJ1' then price else 0 end) as relprice
from posptypeview a
left join PosPtypePriceView b on a.ptypeid = b.ptypeid
where a.ptypeid = @Ptypeid and b.pricetypeid in(@PriceTypeid,'LSSJ1')
end
GO
------------------------------------------------------