create table tb
(
uid int,
mark int
)
insert into tb select 1,9
union all select 2,5
union all select 3,8
union all select 4,6
select uid,mc=(select count(1) from tb where mark>(select mark from tb where uid=4))
from tb
where uid=4
/*
uid mc
----------- -----------
4 2
先求出总和
$query = mysql_query("select uid,sum(mark) as mark from table group by uid order by mark desc");
$mc = 0;
while($res = mysql_fetch_row($query))
{
if($res['uid'] != 4) $mc++;
else break;
}