Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- locale,
- d::date,
- total
- from
- generate_series(current_date - interval '1 months', current_date, interval '1 day') as d
- join lateral (
- select
- l.name as locale,
- count(*) as total
- from content c
- inner join films f on f.content_id = c.id
- left join films_info fi on fi.film_id = f.id
- inner join locales l on l.id = fi.locale_id
- where c.content_type = 'movie' and c.created_at < d
- group by l.name) s on true
- order by
- d desc,
- locale asc;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement