| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 462 人关注过本帖
标题:最近在学习数据库,遇到好多问题,还希望大家多多帮忙啊,谢谢啦
只看楼主 加入收藏
liangfengfen
Rank: 2
等 级:论坛游民
帖 子:50
专家分:10
注 册:2010-8-22
结帖率:87.5%
收藏
 问题点数:0 回复次数:0 
最近在学习数据库,遇到好多问题,还希望大家多多帮忙啊,谢谢啦
--风景点
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语句往哪里插啊,求帮忙啊,急,急,急啊,灰常的急啊。
搜索更多相关主题的帖子: 数据库 风景点 where 
2011-06-05 00:50
快速回复:最近在学习数据库,遇到好多问题,还希望大家多多帮忙啊,谢谢啦
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011069 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved