- SELECT DISTINCT DATE_TRUNC('month', event_time)::date AS month,
- COUNT(event_id) OVER (partition BY DATE_TRUNC('month', event_time)) AS e_month,
- COUNT(event_id) OVER (order BY DATE_TRUNC('month', event_time))
- FROM tools_shop.events
- WHERE user_id IN (SELECT user_id FROM tools_shop.events) AND event_name = 'view_item'