SET @i = 0;And then the select-query with the subquery including the LIMIT:SELECT * FROM my_table WHERE id_my_other_table IN( SELECT id FROM my_other_table WHERE ( @i := ( @i +1 ) ) <= 10 );