SELECT id, name, rank FROM
(
SELECT t.id, t.name,
@rownum := @rownum + 1 AS rank
FROM TABLE t, (SELECT @rownum := 0) r
ORDER BY name ASC
) `selection` WHERE id=1
Dimodifikasi dari jawaban ini>> ROW_NUMBER() di MySQL
SELECT id, name, rank FROM
(
SELECT t.id, t.name,
@rownum := @rownum + 1 AS rank
FROM TABLE t, (SELECT @rownum := 0) r
ORDER BY name ASC
) `selection` WHERE id=1
Dimodifikasi dari jawaban ini>> ROW_NUMBER() di MySQL