冒险岛中贝属性:asp怎样获取任意一条记录在整个表内的排名

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 09:32:59
比如一个计数器:
表user有几下字段
id
username
count

count表示总访问量,比如有个用户:abc,怎样显示abc在整个表内的总访问量排名?
给出具体代码

select count(*)+1 from [user] where [count]>(select [count] from [user] where username = 'abc')

同意

避免使用SQL命令做字段名记住了,是会出问题的

移到abc所在的行,用rs.AbsolutePosition获取行号
select count(*)+1 from [user] where [count]>(select [count] from [user] where username = 'abc')

rs.open "select count(*) from [user] where [count]>(select [count] from [user] where username like 'abc')"
附带说句:尽量不要用user、count等关键字来命名

鍚屾剰涓婇溃闾d綅镄勫仛娉曪紝涓嶈绷鎴戞瘮杈冨皬蹇冧竴镣
绾《湁涓€镣圭偣涓嶅悓灏辨槸锷犱简涓€涓?竴
rs.open "select count(*)+1 from [user] where [count]>(select [count] from [user] where username like 'abc')"

select count(*)+1 from [user] where [count]>(select [count] from [user] where username = 'abc')