问题太散,只能整合下问了

lionz1023 2009-07-08 05:49:45



<div class="mcolumn">
<h2>政策法规</h2><span><a href="#"><img src="images/prints/more1.gif" alt="点击查看更多"/></a></span>
</div>

<div class="c_column">

<img src="images/pic2.gif" width="130" height="110" alt="信息图片"/> [这个地方要读数据库]
<ul>
<%for i=1 to 5%> [这个地方要读数据库]

<li class="frank"><a href="#">重点推荐政策的标题部分标题重点推荐政策的标题部分标题</a></li>
<%next%>
</ul>

<div class="line clear2"></div>

<img src="images/pic1.gif" width="130" height="110" alt="信息图片"/> [这个地方要读数据库]

<ul>
<%for i=1 to 5%> [这个地方要读数据库]

<li class="frank"><a href="#">按添加顺序排列的标题部分标按添加顺序排列的标题部分标</a></li>
<%next%>
</ul>

</div>
</div>


栏目1:分 A,B上下两块

A: 左 (查询最新的pho=1的信息) 右 查询最新4天条信息
B: 左 (查询最新的pho=1的信息) 右 查询最新4天条信息
因为AB在一起 为了不引起信息重复。
sql:(A 左) select top 1 * from a where pho=1 order by id desc (A 右) select top 4 * from a order by id desc

sql:(B 左)select top 1 * from a where pho=1 and id <>(select top 1 id from a where pho=1 order by id desc)
and id not in(select top 4 id from a order by id desc)

(B 右)………………(很长)

为了避免信息重复,遇到这种形式的页面 我得查询4次数据库 而且sql 还比较繁琐。

求助:高手给一个比较简便的解决方案!
...全文
32 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lionz1023 2009-07-08
  • 打赏
  • 举报
回复
是同一个分类
不过 有 读取1个图片 (pro=1)和最新的5条信息该怎么写成一条? 前5条中不一定就会出现 pro=1
街头小贩 2009-07-08
  • 打赏
  • 举报
回复
你的想法是错的!
新闻没有分类么?如果图片中显示的是同一个分类的新闻,有一条SQL即可.
至于怎么分成上下两截.简单写一下伪代码
If Not rs.EOF then
dim i:i=1
response.write "<ul>"
Do While Not rs.EOF
response.write"<li>"&rs("topic")&"</li>"
i=i+1
if i=5 then response.write "</ul><ul>"
rs.movenext
loop
end if

尽量从HTML的方面解决.不要为了样式去支配代码.毕竟css可以让div在页面的任何位置

28,404

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧