Skip to content

Commit

Permalink
fix(stats): distinct movie stats by user
Browse files Browse the repository at this point in the history
  • Loading branch information
believer committed Dec 31, 2023
1 parent 0381ba2 commit 59bd9e4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions db/queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,16 @@ SELECT
COUNT(*) AS count,
p.name,
p.id
FROM
seen AS s
FROM ( SELECT DISTINCT ON (movie_id)
movie_id
FROM
seen
WHERE
user_id = 1) AS s
INNER JOIN movie_person AS mp ON mp.movie_id = s.movie_id
INNER JOIN person AS p ON p.id = mp.person_id
WHERE
user_id = 1
AND mp.job = $1
mp.job = $1
GROUP BY
p.id
ORDER BY
Expand Down

0 comments on commit 59bd9e4

Please sign in to comment.