Run on server, update dependencies
This commit is contained in:
13
scripts/queries/history.sql
Normal file
13
scripts/queries/history.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
-- select t.name as track, a.name as artist
|
||||
select distinct on (1)
|
||||
timestamp, substring(t.name for 50) as track, a.name as artist
|
||||
from api_history as h
|
||||
join api_track as t
|
||||
on h.track_id = t.id
|
||||
join api_track_artists ta
|
||||
on ta.track_id = t.id
|
||||
join api_artist a
|
||||
on a.id = ta.artist_id
|
||||
order by timestamp desc
|
||||
-- ;
|
||||
limit 20;
|
||||
12
scripts/queries/most-played.sql
Normal file
12
scripts/queries/most-played.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
-- select t.name as track, a.name as artist
|
||||
select substring(t.name for 50) as track, a.name as artist, count(t.id)
|
||||
from api_history as h
|
||||
join api_track as t
|
||||
on h.track_id = t.id
|
||||
join api_track_artists ta
|
||||
on ta.track_id = t.id
|
||||
join api_artist a
|
||||
on a.id = ta.artist_id
|
||||
group by t.id, a.id
|
||||
order by count(t.id) desc;
|
||||
-- limit 10;
|
||||
Reference in New Issue
Block a user