chore: search cleanup
This commit is contained in:
parent
19d17f70d2
commit
fca18da3f7
36 changed files with 71 additions and 60 deletions
17
queries/views/media/music/three-month/genres.psql
Normal file
17
queries/views/media/music/three-month/genres.psql
Normal file
|
@ -0,0 +1,17 @@
|
|||
CREATE OR REPLACE VIEW three_month_genres AS
|
||||
SELECT
|
||||
ol.genre_name,
|
||||
ol.genre_url,
|
||||
COUNT(*) AS plays,
|
||||
json_build_object(
|
||||
'alt', ol.genre_name,
|
||||
'subtext', CONCAT(COUNT(*), ' plays')
|
||||
) AS grid
|
||||
FROM
|
||||
optimized_listens ol
|
||||
WHERE
|
||||
TO_TIMESTAMP(ol.listened_at) >= NOW() - INTERVAL '3 months'
|
||||
GROUP BY
|
||||
ol.genre_name, ol.genre_url
|
||||
ORDER BY
|
||||
plays DESC;
|
Reference in a new issue