Untitled

From Obese Plover, 10 Months ago, written in PostgreSQL, viewed 106 times. This paste will kick the bucket in 1 Second.
URL http://codebin.org/view/51f9dc9b Embed
Download Paste or View Raw
  1. SELECT
  2.   DATE_TRUNC('month', event_time::date) AS month,
  3.   COUNT(event_id) AS events_count,
  4.   SUM(COUNT(event_id)) OVER (ORDER BY DATE_TRUNC('month', event_time::date)) AS cumulative_count
  5. FROM tools_shop.events
  6. WHERE event_name = 'view_item'
  7.   AND user_id IN (SELECT user_id FROM tools_shop.users)
  8. GROUP BY DATE_TRUNC('month', event_time::date)

Reply to "Untitled"

Here you can reply to the paste above