sql - Limit on GROUP BY in Postgresql -
i need have query group tracks created date(month) , limit every group max 10 results.
i'm trying in way:
select "tracks".* (select row_number() on (order tracks.votes_count desc) r, t.* tracks t 1=1 ) x x.r <= 10
but give me error on clause:
error: missing from-clause entry table "tracks"
where i'm doing wrong ? how should correct query ?
x
alias exposed. need change tracks
alias x
.
select x.* (select row_number() on (order tracks.votes_count desc) r, t.* tracks t 1=1 ) x x.r <= 10
Comments
Post a Comment