ALTER FUNCTION [dbo].[fun_tongji]()
RETURNS @t1 table (
yue int ,
money int
)
AS
begin
Declare @i int
set @i=1
-- declare @t1 table (
-- yue int ,
-- money int
-- )
while (@i<=12)
begin
INSERT into @t1 (yue,money) select isnull(sum(money),0) as money,@i as yue from zhangbenjilu where datepart(month,usedatetime)=@i
set @i=@i+1
end
return ;
end