Guest User

Untitled

a guest
Dec 3rd, 2019
91
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2. EXTRACT(week FROM SUBQ.trunc_date) AS week_number,
  3. AVG(SUBQ.transaction_per_day) AS avg_week_transaction
  4. FROM
  5. (SELECT
  6. COUNT(distinct id_transaction) as transaction_per_day,
  7. DATE_TRUNC('day', date) AS trunc_date
  8. FROM
  9. transactions
  10. GROUP BY
  11. trunc_date) AS SUBQ
  12.  
  13. GROUP BY
  14. week_number
RAW Paste Data