alter function dbo.anf ( @mdvn int, @fdate datetime, @tdate datetime ) returns @tab table(DVN_CD int,PHC_CD int,HSC_CD int,ANC int) AS Begin declare @vdate date declare @fedddate date declare @tedddate date declare @tvdate date set @vdate=dateadd(dd,-91,@fdate) set @tvdate=dateadd(dd,36,@tdate) set @fedddate=dateadd(dd,20,@fdate) set @tedddate=dateadd(dd,310,@tdate) declare @ANC int set @ANC=ANC select dvn_cd,phc_cd,hsc_cd,SUM(ANC) as ANC from ( select dvn_cd,phc_cd,hsc_cd, case when visit_no=3 and ANEDD between @vdate and @tvdate then 1 else 0 end as ANC from ANVisits3 a where DVN_CD=@mdvn and ANEDD between @fedddate and @tedddate )a group by dvn_cd,phc_cd,hsc_cd return @tab end
alter function dbo.anf ( @mdvn int, @fdate datetime, @tdate datetime ) returns table AS Begin
AS
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)