注册 登录
编程论坛 ASP技术论坛

一连串点击率问题

zzhman 发布于 2011-03-07 12:02, 875 次点击
大虾们:
我主要是实现
1.排在前5个点击率的排行榜(内容是10个视频的连接地址)
2.如果点击率中有一样的也只显示5个
只有本站会员才能查看附件,请 登录

这上面显示了6个
请大虾们帮写个代码把,我自己的太垃圾了就不黏贴过来了
11 回复
#2
gupiao1752011-03-07 14:14
如果点击浏览次数字段为数字字段,名为hit
那么SQL语句里这么写:select top 5 * from 表 order by hit desc//这样就只能查到5条了。即获取hit字段里的数字最大的前5个!
#3
zzhman2011-03-07 23:27
select top 5 * from web_news order by nHits desc
加上以后是可以排序,可是遇见点击率一样的就都显示出来了
如图:
只有本站会员才能查看附件,请 登录

是不是还要加上点别的才能实现
#4
zznice2011-03-08 02:11
那就对查询的记录集进行一个判断,超过五个就减一
#5
hams2011-03-08 08:13
做个累加器不行么?
#6
zzhman2011-03-09 00:03
能不能给个集体方案大虾们,多谢
#7
hams2011-03-09 08:01
累加器都不会的话,你也就别问了。
#8
zzhman2011-03-09 16:48
这样呀,那我先学学
#9
zzhman2011-03-10 11:03
版主能给个具体实施方案或代码吗?
急用》》》》》》、
#10
hams2011-03-10 14:46
s=0
……
S=S+1
if S>5 then ……
#11
zzh_man2011-03-28 11:38
还是不懂代码能详细点吗
这是我的代码
<%
exec="select top 6 * from  web_news order by id desc "
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<%
if rs.eof and rs.bof then
response.write("暂时没有数据")
else
do while not rs.eof
%>      
<table width="100%" border="3" cellpadding="4" cellspacing="4">
  <tr>
    <th width="65%" scope="row">下载排行榜</th>
    <td width="35%">浏览次数</td>
   
  </tr>
  <tr>
    <th scope="row"><a href="http://sjzfls. target="_blank"><%=trim(rs("nTitle"))%><font color="#8F8F8F">日期:</font><%=trim(rs("nTime"))%></a></th>
    <td><div align="center"><%=trim(rs("nHits"))%>次</div></td>
  </tr>
   
</table>
<%
rs.movenext
loop
end if
%>
#12
hams2011-03-28 14:32
<%s=0
exec="select top 6 * from  web_news order by id desc "
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<%
if rs.eof and rs.bof then
response.write("暂时没有数据")
else
do while s>4 AND not rs.eof
s=s+1
%>      
<table width="100%" border="3" cellpadding="4" cellspacing="4">
  <tr>
    <th width="65%" scope="row">下载排行榜</th>
    <td width="35%">浏览次数</td>
   
  </tr>
  <tr>
    <th scope="row"><a href="http://sjzfls. target="_blank"><%=trim(rs("nTitle"))%><font color="#8F8F8F">日期:</font><%=trim(rs("nTime"))%></a></th>
    <td><div align="center"><%=trim(rs("nHits"))%>次</div></td>
  </tr>
   
</table>
<%
rs.movenext
loop
end if
%>
1