Masz dobry pomysł. MySQL nie gwarantuje jednak kolejności oceny wyrażeń. Dodatkowo masz group by position
w podzapytaniu.
Myślę więc, że możesz chcieć:
SELECT . . .
FROM (SELECT name, surname, position, value, points,
(@num := if(@type = position, @num + 1,
if(@type := position, 1, 1)
)
) AS row_number
FROM players p CROSS JOIN
(SELECT @num := 0, @type := '') params
WHERE (name LIKE '%$searchphrase%' OR surname LIKE '%$searchphrase%') AND
value >= '$minvalue' AND value <= '$maxvalue'
ORDER BY position
) x
WHERE x.row_number <= 2