有一个积分表,积分从高往下排,如何取出其中的一个用户的排名,积分
sql语句是
<br />select a.username,(@rowNum:[email protected]+1) as c,a.integral as 积分<br />from xs_user a,(Select (@rowNum :=0 ) ) b order by integral DESC,time<br />
SELECT * FORM <br /> (<br /> select a.username,(@rowNum:[email protected]+1) as c,a.integral as 积分<br /> from xs_user a,(Select (@rowNum :=0 ) ) b order by integral DESC,time<br /> ) T<br /> WHERE username='XXX'