Necesita un nivel más:
Código sql:
Ver originalSELECT (@n:=@n+1) Pos, Nombre, Apel1, Apel2, DNI, Categoria
FROM
(SELECT @n, Nombre, Apel1, Apel2, DNI, Categoria
FROM Nombres JOIN DNI ON RefIdDNI=IdDNI JOIN Categorias ON RefIdCategoria=IdCategoria, (SELECT @n:=0) NUM
WHERE RefIdCategoria<9
GROUP BY Categoria
ORDER BY Apel1, Apel2, Nombre ) T1;
La clave es que el listado se debe numerar cuando ya no va a sufrir ningún tipo de cambios.