create proc pro_PAS_ShowCaseInfoList
@tid int,
@pageindex int,
@pagesize int
as
select top(@pagesize) * from PAS_ShowCaseInfo
where isshow=1 and tid=@tid and id not in (select top ((@pageindex-1)*@pagesize) id from PAS_ShowCaseInfo
where isshow =1 and tid=@tid order by publishtime desc ,id desc)
order by publishtime desc,id desc
go
------------------------------
select count(id) from PAS_ShowCasePhotos where sid in (select id from PAS_ShowCaseInfo where tid=@tid) group by sid
就是把横线下面的sql语句加到上面的存储过程里,写成一个查询语句。
怎么,搞啊。谢谢了