SELECT `c`.*
FROM comments AS `c` WHERE `c`.`articleId` IN (
'44',
'55',
'414',
'555',
'775'
) AND `c`.`approved` ='1' ORDER BY `c`.`date` DESC;
select *
from (SELECT `c`.*, row_number() OVER (partition by `c`.`articleId` order by `c`.`date` DESC ) rn
FROM comments AS `c` WHERE `c`.`articleId` IN (
'44',
'55',
'414',
'555',
'775'
) AND `c`.`approved` ='1' ORDER BY `c`.`date` DESC) t1
where rn <= 5;