CREATE proc getInfo
@sip varchar(50), /*传入参数*/
@dip varchar(50), /*传入参数*/
@Zgjcs int output,
@Zbgjcs int output,
@Gjcs int output,
@Zfsbs int output,
@Zfssjl int output,
@Zjsbs int output,
@Zjssjl int output,
@Fsbs int output,
@Fssjl int output
as
begin
@Zgjcs = select (select count(*) from Program1 where [email protected] ) + (select count(*) from Program2 where [email protected]);
@Zbgjcs = select (select count(*) from Program1 where [email protected]) + (select count(*) from Program2 where [email protected]);
@Gjcs = select (select count(*) from Program1 where [email protected] and [email protected]) + (select count(*) from Program2 where [email protected] and [email protected]);
select @Zfsbs = (sum(a.trigger_times)+sum(b.repeat)), @Zfssjl = sum(b.traffic) from Program1 a, Program2 b where [email protected] or [email protected];
select @Zjsbs = (sum(a.trigger_times)+sum(b.repeat)), @Zjssjl = sum(b.traffic) from Program1 a, Program2 b where [email protected] or [email protected];
select @Fsbs = (sum(a.trigger_times)+sum(b.repeat)), @Fssjl = sum(b.traffic) from Program1 a, Program2 b where ([email protected] and [email protected]) or ([email protected] and [email protected]);
end
GO
------解决方案--------------------
@Zgjcs = select (select count(*) from Program1 where [email protected] ) + (select count(*) from Program2 where [email protected]);
是不是应该是
select @Zgjcs=(select count(*) from Program1 where [email protected] ) + (select count(*) from Program2 where [email protected]);
------解决方案--------------------
CREATE proc getInfo
@sip varchar(50), /*传入参数*/
@dip varchar(50), /*传入参数*/
@Zgjcs int output,
@Zbgjcs int output,
@Gjcs int output,
@Zfsbs int output,
@Zfssjl int output,
@Zjsbs int output,
@Zjssjl int output,
@Fsbs int output,
@Fssjl int output
as
begin
set @Zgjcs = (select count(*) from Program1 where [email protected] ) + (select count(*) from Program2 where [email protected])
set @Zbgjcs = (select count(*) from Program1 where [email protected]) + (select count(*) from Program2 where [email protected])
set @Gjcs = (select count(*) from Program1 where [email protected] and [email protected]) + (select count(*) from Program2 where [email protected] and [email protected])
select @Zfsbs = (sum(a.trigger_times)+sum(b.repeat)), @Zfssjl = sum(b.traffic) from Program1 a, Program2 b where [email protected] or [email protected]
select @Zjsbs = (sum(a.trigger_times)+sum(b.repeat)), @Zjssjl = sum(b.traffic) from Program1 a, Program2 b where [email protected] or [email protected]
select @Fsbs = (sum(a.trigger_times)+sum(b.repeat)), @Fssjl = sum(b.traffic) from Program1 a, Program2 b where ([email protected] and [email protected]) or ([email protected] and [email protected])
end
GO
这样试试