34,874
社区成员
发帖
与我相关
我的任务
分享
create procedure proc_sale_sum
@参数1 int,@参数2 int
as
declare @变量 int
declare @变量 int
create procedure proc_sale_sum
as
begin
--变量定义要放到这里面的
declare @sum int
declare @tp1 int
declare @tp2 int
set @sum= @tp1+@tp2
select top 10 a.itemcode,a.dscription,sum(a.quantity) as '@tp1'
from rin1 a
left join (select top 10 b.U_008,b.dscription,sum(b.quantity) as '@tp2'
from rin1 b
where b.itemcode='1000001'
group by b.U_008,b.dscription
)b on a.itemcode=b.U_008
group by a.itemcode,a.dscription
end
GO