最近在学习数据库,遇到好多问题,还希望大家多多帮忙啊,谢谢啦
--风景点create proc pro_PAS_SiteIntroInfo
@id int
as
declare @sid int
declare @PublishTime datetime
select @sid=sid from PAS_SiteIntroInfo where isshow=1 and id=@id
select @PublishTime =publishtime from PAS_SiteIntroInfo where isshow=1 and id=@id
select *,
(select top 1 id from PAS_SiteIntroInfo where isshow=1 and sid=@sid and publishtime>@publishtime order by publishtime)as preid,
(select top 1 title from PAS_SiteIntroInfo where isshow=1 and sid=@sid and publishtime>@publishtime order by publishtime)as pretitle,
(select top 1 id from PAS_SiteIntroInfo where isshow=1 and sid=@sid and publishtime<@publishtime order by publishtime desc)as nextid,
(select top 1 title from PAS_SiteIntroInfo where isshow=1 and sid=@sid and publishtime<@publishtime order by publishtime desc)as nexttitle
from PAS_SiteIntroInfo
where isshow=1 and id=@id
order by publishtime desc,ReadCount desc,id desc
go
exec pro_PAS_SiteIntroInfo 7
go
--详细图片
create proc pro_PAS_SiteIntroPhotos
@id int
as
select * from PAS_SiteIntroPhotos where sid=@id
go
---------------------------------------------------------
根据风景地的id查到该风景,同时查出对应的图片,并且显示出来,
我想做的就是把两个存储过程写到一个存储过程里面,内,外链接我知道的,关键是风景点那个表是先查处所以字段,而且要查带括号的上下页 ,我就懵了,不知道该把详细图片的SQL语句往哪里插啊,求帮忙啊,急,急,急啊,灰常的急啊。