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
Aangepast vanuit dit antwoord>> ROW_NUMBER() in 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
Aangepast vanuit dit antwoord>> ROW_NUMBER() in MySQL