create proc p_rbb
as
select sum(xsje) xsje,sum(jhdj*xssl) cbje from table_xsbb a inner join table_jhgl b
on datediff(d,sj,getdate())=0 and b.sph in (select a.sph from table_xsbb)
go