SELECT
`notifications`.*,
COUNT(DISTINCT `notification_user`.`user_id`) AS `users_count`
FROM `notifications`
LEFT JOIN `notification_user` ON `notification_user`.`notification_id` = `notifications`.`id`
GROUP BY `notifications`.`id`
ORDER BY `notifications`.`created_at` DESC
LIMIT 10
OFFSET 0;
SELECT
`notifications`.*,
COUNT(DISTINCT `notification_user`.`user_id`) AS `users_count`
FROM `notifications`
LEFT JOIN `notification_user` ON `notification_user`.`notification_id` = `notifications`.`id`
GROUP BY `notifications`.`id`
ORDER BY `notifications`.`created_at` DESC
LIMIT 10
OFFSET 0;