SELECT total, rank FROM (
Select user_id, total ,@rank := @rank + 1 As rank
From (
select user_id, sum(walkcnt) as total
from my_runtoyou, (select @rank := 0) rr
where admin_yn ='y' and show_yn ='y'
group by user_id
order by total desc) rtu
) Tbl
WHERE user_id ='$user_id'