34,592
社区成员
发帖
与我相关
我的任务
分享
create function get_sum(@id int)
returns int
as
declare @sum int
select @sum = sum(a.c)+sum(b.d+b.e)
from a,b
where a.id = b.id and a.id = @id
return @sum
end
go
update a set a=b.D+b.E from a left join b on a.ID=b.ID
declare @id int
set @id = ???
select sum(a.c)+sum(b.d+b.e)
from a,b
where a.id = b.id and a.id = @id
--怎么还用函数呢?