create proc UInfo(@Uid varchar(36))
as
begin
declare @ResultDt table(cname varchar(64),acount int,ccount int,scount int)
set @Uid='simao'
declare @tempcount int
insert into @ResultDt select
'商铺 ',(select count(1) from ShopOffice where UID=@Uid),(select count(1) from ShopOffice where SCommand=1 and UID=@Uid),(select count(1) from ShopOffice where NStatus=3 and UID=@Uid)
insert into @ResultDt select
'写字楼',(select count(1) from OfficeBuilding where UID=@Uid),(select count(1) from OfficeBuilding where SCommand=1 and UID=@Uid),(select count(1) from OfficeBuilding where NStatus=3 and UID=@Uid)
insert into @ResultDt select
'工业地产',(select count(1) from Industrial where UID=@Uid),(select count(1) from Industrial where SCommand=1 and UID=@Uid),(select count(1) from Industrial where NStatus=3 and UID=@Uid)
insert into @ResultDt select
'大型项目',(select count(1) from Project where UID=@Uid),(select count(1) from Project where SCommand=1 and UID=@Uid),(select count(1) from Project where NStatus=3 and UID=@Uid)
insert into @ResultDt select
'生意转让',(select count(1) from Bussiness where UID=@Uid),(select count(1) from Bussiness where SCommand=1 and UID=@Uid),(select count(1) from Bussiness where NStatus=3 and UID=@Uid)
insert into @ResultDt select
'合计',sum(acount),sum(ccount),sum(scount) from @ResultDt
select * from @ResultDt
end
as
begin
declare @ResultDt table(cname varchar(64),acount int,ccount int,scount int)
set @Uid='simao'
declare @tempcount int
insert into @ResultDt select
'商铺 ',(select count(1) from ShopOffice where UID=@Uid),(select count(1) from ShopOffice where SCommand=1 and UID=@Uid),(select count(1) from ShopOffice where NStatus=3 and UID=@Uid)
insert into @ResultDt select
'写字楼',(select count(1) from OfficeBuilding where UID=@Uid),(select count(1) from OfficeBuilding where SCommand=1 and UID=@Uid),(select count(1) from OfficeBuilding where NStatus=3 and UID=@Uid)
insert into @ResultDt select
'工业地产',(select count(1) from Industrial where UID=@Uid),(select count(1) from Industrial where SCommand=1 and UID=@Uid),(select count(1) from Industrial where NStatus=3 and UID=@Uid)
insert into @ResultDt select
'大型项目',(select count(1) from Project where UID=@Uid),(select count(1) from Project where SCommand=1 and UID=@Uid),(select count(1) from Project where NStatus=3 and UID=@Uid)
insert into @ResultDt select
'生意转让',(select count(1) from Bussiness where UID=@Uid),(select count(1) from Bussiness where SCommand=1 and UID=@Uid),(select count(1) from Bussiness where NStatus=3 and UID=@Uid)
insert into @ResultDt select
'合计',sum(acount),sum(ccount),sum(scount) from @ResultDt
select * from @ResultDt
end