Last active
December 22, 2015 06:09
-
-
Save fillest/6428976 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT e.source_id, COUNT(e.*) | |
FROM entries AS e | |
INNER JOIN users__sources AS sassoc | |
ON sassoc.source_id = e.source_id AND sassoc.user_id = :user_id | |
LEFT JOIN users__entries AS eassoc | |
ON eassoc.entry_id = e.id AND eassoc.user_id = :user_id | |
WHERE eassoc.entry_id IS NULL OR eassoc.is_read = FALSE | |
GROUP BY e.source_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment