Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with tbl as (
- select distinct date_trunc('month', event_time)::date as month
- , count(event_id) over(partition by date_trunc('month', event_time)) as events
- from tools_shop.events e
- right join tools_shop.orders o on o.user_id=e.user_id
- where event_name='view_item'
- )
- select month , events::numeric, sum(events) over(order by month)
- from tbl
Add Comment
Please, Sign In to add comment