I've been testing for a couple of days how to get the row number of a query, and in fact I got it but when I upload the code to the server where I have my page hosted, I find a syntax error. I have reviewed the mysql versions and in local I have the version 8.0 while in the server the 5.5
I need to get a query to rescue the most visited places in the world, limiting the number of locations by country and continent. The code that works for me in local is the following:
select * from
(select * , row_number() over (partition by id_continente order by visitas desc) y from
(select *, row_number() over (partition by id_pais order by visitas desc) x from lugar_localidades_top_site where id_site=:site and categoria >=:categoria and id_pais <> :pais_excluido) top
where x <= :loc_por_pais) top_mundo
where y <= :loc_por_continente
order by visitas desc
The error is in the row_number () function since mysql 5.5 does not implement it. Any ideas to solve the issue? (I can not change the server version)