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

帮忙写个排名函数,要求每组排名

lzxm160 发布于 2008-10-03 15:49, 662 次点击
sql语句高手帮忙写个排名的函数


    function getp(id)
    sql="Select count(id) from Candidate where ps>"&ps
    Set ts=cnn.execute(sql)
    getp=ts(0)+1
    end function

参数为选手的id 通过数他前面的id数来排名,但是上面还不对,我想要每组的排名,根据t_group分组 查出id所在组的名次,ps是得票数
1 回复
#2
yms1232008-10-03 17:07
function getp(id)
    sql="Select count(id) from Candidate where ps>"&ps&" group by t_group"
    Set ts=cnn.execute(sql)
    getp=ts(0)+1
 end function
 使用group by 分组呢?
1