SELECT * FROM Quests LEFT JOIN QuestsActive ON Quests.id = QuestsActive.questid WHERE QuestsActive.id IS NULL;
SELECT news.*, count(comments.id) AS "comments_num", count(likes.id) AS "likes_num"
FROM news
LEFT JOIN comments ON comments.newsid = news.id
LEFT JOIN likes ON likes.newsid = news.id
GROUP BY news.id