Im have been query the database to collectively fetch latest record or each item using PARTITION and ROW_COUNT() which works on MariaDB version 10.4* but i want to query the same on a MySQL version 5.7* database but it doesn't work there. I would like to figure out the alternative that will work on the MySQL database. Kindly help me out. The query is as follows.
SELECT A_id, B_id, Created_at
FROM
(
SELECT a.id as A_id, b.id as B_id, b.Created_at,
ROW_NUMBER() OVER (PARTITION BY a.id ORDER BY b.Created_at DESC) AS rn
FROM beta b
JOIN alpha a ON b.a_id = a.id
) q
WHERE rn = 1