create proc sp_test
(@yd varchar(6),
@SupplierID int)
as
select SupplierID ,
@yd,
(select asum from table where SupplierID= @SupplierID and MonthlyID = @MonthlyID and re = 'init')as initdata,
(select sum(asum) from table where SupplierID= @SupplierID and MonthlyID = @MonthlyID and re <> 'init' and Atype = '1') as StockSum,
(select sum(asum) from table where SupplierID= @SupplierID and MonthlyID = @MonthlyID and re <> 'init' and Atype = '0') as PaySum,
(select sum(asum) from table where SupplierID= @SupplierID and MonthlyID = @MonthlyID ) sa Account
from table
go
(@yd varchar(6),
@SupplierID int)
as
select SupplierID ,
@yd,
(select asum from table where SupplierID= @SupplierID and MonthlyID = @MonthlyID and re = 'init')as initdata,
(select sum(asum) from table where SupplierID= @SupplierID and MonthlyID = @MonthlyID and re <> 'init' and Atype = '1') as StockSum,
(select sum(asum) from table where SupplierID= @SupplierID and MonthlyID = @MonthlyID and re <> 'init' and Atype = '0') as PaySum,
(select sum(asum) from table where SupplierID= @SupplierID and MonthlyID = @MonthlyID ) sa Account
from table
go
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货