MySQL 8 DISTINCT with greatest ID

Solution 1:

You may user ROW_NUMBER if on MySQL 8+:

WITH cte AS (
    SELECT *, ROW_NUMBER() OVER (PARTITION BY id_1 ORDER BY id_2 DESC) rn
    FROM ids
    WHERE id_1 IN (123, 124, 125, 126, 127) AND
          id_2 IN (-1, -1, 123, 201, 206)
)

SELECT id_1, id_2, info
FROM cte
WHERE rn = 1;

On earlier versions of MySQL, you can identify the max record per id_1 group using exists logic:

SELECT i1.*
FROM ids i1
WHERE id_1 IN (123, 124, 125, 126, 127) AND
      id_2 IN (-1, -1, 123, 201, 206) AND
      NOT EXISTS (
          SELECT 1
          FROM ids i2
          WHERE i2.id_1 = i1.id_1 AND
                i2.id_2 > i1.id_2 AND
                i2.id_1 IN (123, 124, 125, 126, 127) AND
                i2.id_2 IN (-1, -1, 123, 201, 206)
      );