蓝森林首页 | 返回主页 | 本站地图 | 站内搜索 | 联系信箱 |
 您目前的位置:首页 > 自由软件 > 技术交流 > 应用编程


    

蓝森林 http://www.lslnet.com 2006年8月25日 8:28

[ASP]关于select top 记录的问题

目前,一个留言板
[code]sql="select top 5 * from [用户信息] order by postcount desc"[/code]
也就是按用户发表留言次数取前5名
我的记录里
===============
用户 发表次数
A        11
B        10
C        1
D        0
E        0
F        0
G        0
===============
执行后会把这些所有记录都显示出来
也就是说,存在4个并列第4,所以都显示出来了

请教解决方案,期待回复

order by postcount and id disc
试试看

[code]

sql="select top 5 * from [用户信息] order by postcount desc"
rs.open sql,conn,3,3
if not(rs.bof or eof) then
for i=1 to rs.recordcount
response.write rs("输出字段")
rs.movenext
if i=5 or rs.eof then exit for
next
else
response.write("暂时没有信息")
end if
[/code]


因为:
D 0
E 0
F 0
G 0都是0!等级都在一条线上即同等!




Copyright © 1999-2000 LSLNET.COM. All rights reserved. 蓝森林网站 版权所有。 E-mail : webmaster@lslnet.com