'MySQL pagination with limit returns the same values

I'm trying to do pagination, but the SQL query returns the same values on different pages. I show them the queries and the results, and it shows that there are ids that are repeated in both results.

I think it's the MySQL version because it works perfectly for me locally, I have the '10.4.22-MariaDB' version. Any help, solution, or suggestion, I can't change the server version.

Thanks so much.

MySQL Version

Query 1

Query 2

Number of results



Solution 1:[1]

Thanks @Akina, it's not exactly the solution I was looking for, but it works perfectly. My final query is the following, and the values are no longer shown repeated.

SELECT id FROM `obras` WHERE `estado` = 'publicado' AND `id_idioma` = 1 AND YEAR(fecha) >= '1980' ORDER BY `fecha` DESC, `id` DESC LIMIT 24;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Luis Miguel Molina Betancourt