select count(seq_no)+1 as rank from
(select seq_no from grave_admin_rank where farm_lv >
(select farm_lv from grave_admin_rank where uid='1139420') order by farm_lv desc)as s;
效率較高,1萬筆資料下,查詢一次約0.03sec
SET @rownum := 0;
SELECT rank FROM (
SELECT @rownum := @rownum + 1 AS rank, uid
FROM grave_admin_rank ORDER BY farm_lv DESC
) as result WHERE uid='1139420';
約0.08sec