There are 2 tables:

News with columns: id_news, title_news, content_news, date_news, id_category, is_published.

comments with columns: id_comment, id_user, id_news, comment, id_parent, date_time, is_active.

There are some sketches, but they are very sad ...

SELECT c.*, n.title_news FROM ( SELECT MAX(date_time) tense, id_news FROM comments GROUP BY id_news LIMIT 5 ) c LEFT JOIN news n ON n.id_news = c.id_news; 

    1 answer 1

     SELECT n.*, c.cnt FROM news n, (SELECT COUNT(*) cnt, id_news FROM comments WHERE date_time > NOW() - INTERVAL 1 DAY GROUP BY id_news ORDER BY 1 DESC LIMIT 5 ) c WHERE n.id_news = c.id_news; 

    Ps. Yes, the sketches were sad ... getting the maximum TIME, when you need to select on the QUANTITY - this is strong.