CREATE FUNCTION everday ()
RETURNS @temp1 table(pronum char(10),presort int,nowin int,nowout int,nowsort int)
AS
BEGIN
insert into @temp1(pronum,nowsort,presort) select a.pronum,nowsort=a.number,presort=b.number from pro_product a left outer join pro_daynumber b on a.pronum=b.pronum where b.modtime=(select max(modtime) from pro_daynumber)and a.classes<>'组合'
update @temp1 set nowin=a.nownum from pro_ioput a,@temp1 b where a.pronum =b.pronum and a.type=1
update @temp1 set nowout =a.nownum from pro_ioput a,@temp1 b where a.pronum = b.pronum and a.type=2
return
END
RETURNS @temp1 table(pronum char(10),presort int,nowin int,nowout int,nowsort int)
AS
BEGIN
insert into @temp1(pronum,nowsort,presort) select a.pronum,nowsort=a.number,presort=b.number from pro_product a left outer join pro_daynumber b on a.pronum=b.pronum where b.modtime=(select max(modtime) from pro_daynumber)and a.classes<>'组合'
update @temp1 set nowin=a.nownum from pro_ioput a,@temp1 b where a.pronum =b.pronum and a.type=1
update @temp1 set nowout =a.nownum from pro_ioput a,@temp1 b where a.pronum = b.pronum and a.type=2
return
END
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货