SELECT * FROM (SELECT user_id,(@rowNum:=@rowNum+1) AS rowNoFROM tab_users,(SELECT(@rowNum:=0)) b ORDERBY age DESC) c WHERE user_id=216;