不知道怎么改了
麻烦帮我看看
create function f_Profit(@lb char(10))
RETURNS @ProfitTable table(
goodid char(10),
sumprofit int)
as
begin
insert into @ProfitTable
select a.goodid,SUM(salenum*(saleprice-goodprice)) as sumprofit
from a join b on a.goodid=b.goodid
where a.goodid in(select goodid from a where goodlb=@lb)
group by a.goodid
order by sumprofit desc
end
return
GO