В MariaDB 10.2 или более поздней версии вы можете использовать CTE
и оконные функции:
WITH CTE AS (
SELECT *,
ROW_NUMBER() OVER (PARTITION BY artistId ORDER BY createdAt DESC) AS rn
FROM contentnew
WHERE genreID = 1 AND mainContent = 1 AND countryID = 4
)
SELECT id, title, genreID, countryID, artistID, albumID, reg_count, down_count, createdAt
FROM CTE
WHERE rn = 1
Вывод:
id title genreID countryID artistID albumID reg_count down_count createdAt
2 ww 1 4 1 2 56 52 2020-05-05 03:00:00
3 ee 1 4 8 15 34 26 2020-05-05 21:00:00
Демо на dbfiddle