Commit 45122b12 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Add example query for nr of comments by class.

parent 325c7897
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -91,6 +91,15 @@ FROM comments JOIN targets ON comments.target_id = targets.id
WHERE target.domain = ?
GROUP BY target.id

-- get number of comments for each class (including comments for class members)

SELECT
    target.cls AS cls,
    count(*) AS cnt
FROM comments JOIN targets ON comments.target_id = targets.id
WHERE target.domain = ? AND target.type = 'class'
GROUP BY target.cls

-- get users with the highest score

SELECT