summaryrefslogtreecommitdiff
path: root/sql/weighted.sql
blob: dfa23c16f6255e6d5094865bb8392e6aa194998f (plain)
1
2
3
4
5
6
7
8
CREATE OR REPLACE VIEW user_track_weighted AS (
    SELECT *, "count" / (
        SELECT SUM("count")
        FROM user_track ut
        WHERE ut.user_id = user_id
    )::decimal AS score
    FROM user_track
);