(!!!急)存储过程的问题
CREATE PROCEDURE select_aForumTitle_1
(
@DisAreaId int
)
as
select count(Content) as count1
from
aContent
join
aForum
on
aContent.ForumId=aForum.Id
where
aForum.DisAreaId=@DisAreaId
group by
ForumId
GO
CREATE PROCEDURE select_aForumTitle
(
@DisAreaId int
)
as
select
b.Id ,a.Title,b.SendName as Name2,b.AddTime,c.Name
from
aDisArea as a
join
aForum as b
on
b.DisAreaId=a.Id
join
aMember as c
on
b.SendId=c.Id
where
b.DisAreaId=@DisAreaId
order by
a.AddTime
GO
请问怎么把这两个存储过程合并成一个存储过程呢??)
[解决办法]
CREATE PROCEDURE select_aForumTitle
@DisAreaId int
as
begin
declare @tcount int
select
@tcount=isnull(count(Content),0)
from
aContent
join
aForum
on
aContent.ForumId=aForum.Id
where
aForum.DisAreaId=@DisAreaId
group by
ForumId
select
@tcount as count1,b.Id ,a.Title,b.SendName as Name2,b.AddTime,c.Name
from
aDisArea as a
join
aForum as b
on
b.DisAreaId=a.Id
join
aMember as c
on
b.SendId=c.Id
where
b.DisAreaId=@DisAreaId
order by
a.AddTime
end
GO