(no title)
hotdamnson | 3 years ago
Here is some proper SQL query:
SELECT DISTINCT
r.id,
r.owner_id,
r.name,
COUNT(r.id) OVER (PARTITION BY r.id) AS COUNT
FROM repository r
JOIN star s ON s.repository_id = r.id
ORDER BY 4 DESC;
jakewins|3 years ago
You are counting all stars of all repos, they are counting stars of one (parameterized) repo id.
hotdamnson|3 years ago
Where r.id = :repo
and you will have the same thing.