Untitled

From Violet Goat, 10 Months ago, written in SQL, viewed 218 times.
URL http://codebin.org/view/e0962793 Embed
Download Paste or View Raw
  1. SELECT SUM(total_amt) / COUNT(DISTINCT u.user_id) AS arppu,
  2.     CAST(DATE_TRUNC('year', o.created_at) AS DATE) year_arppu
  3. FROM tools_shop.users u
  4.     JOIN tools_shop.orders o ON u.user_id = o.user_id
  5. GROUP BY year_arppu;

Reply to "Untitled"

Here you can reply to the paste above