Sem ROW_NUMBER(), você pode fingir por esta resposta ou este :
SELECT @i := @i + 1 AS i, COUNT(*), ...
FROM affiliates_earnings
JOIN (SELECT @i := 0) dummy
WHERE ...
GROUP BY ...;
SELECT @i := @i + 1 AS i, COUNT(*), ...
FROM affiliates_earnings
JOIN (SELECT @i := 0) dummy
WHERE ...
GROUP BY ...;