select @i:=@i+1,tnum from (SELECT ssn,SUM(snum) AS tnum FROM v_fahuolog_jmsapply_vip where proid='0010001' GROUP BY uid order by tnum desc) as t,(select @i:=0) as n