CREATE DEFINER=`root`@`localhost` PROCEDURE `getInfo`(
in sip varchar(50),
in dip varchar(50),
out Zgjcs int,
out Zbgjcs int,
out Gjcs int,
out Zfsbs int,
out Zfssjl int,
out Zjsbs int,
out Zjssjl int,
out Fsbs int,
out Fssjl int
)
BEGIN
  select Zgjcs = ((select count(*) from Program1 where  sip=sip ) + (select count(*)  from Program2 where  sip=sip));
  select Zbgjcs = ((select count(*)  from Program1 where  dip=dip) + (select count(*)  from Program2 where  dip=dip));
  select Gjcs = ((select count(*) from Program1 where  sip=sip and dip=dip) +  (select count(*)  from Program2 where  sip=sip and dip=dip));
  select Zfsbs = (sum(a.trigger_times)+sum(b.repeat1)), Zfssjl = sum(b.traffic) from Program1 a, Program2 b where a.sip=sip or b.sip=sip;
  select Zjsbs = (sum(a.trigger_times)+sum(b.repeat1)), Zjssjl = sum(b.traffic) from Program1 a, Program2 b where a.dip=dip or b.dip=dip;
  select Fsbs =  (sum(a.trigger_times)+sum(b.repeat1)), Fssjl = sum(b.traffic)  from Program1 a, Program2 b where (a.sip=sip and a.dip=dip) or (b.sip=sip and b.dip=dip);
END;