From Colorant Dove, 9 Months ago, written in Plain Text, viewed 130 times.
URL http://codebin.org/view/b06fc61f Embed
Download Paste or View Raw
  1. SELECT invoice_date,-- впишите поле с категориями
  2.        SUM(total),
  3.            COUNT(DISTINCT customer_id),
  4.            SUM(total)/COUNT(DISTINCT customer_id)
  5. FROM invoice
  6. WHERE billing_country = 'USA'
  7. AND DATE_TRUNC('week', CAST(invoice_date AS timestamp)
  8. GROUP BY invoice_date;

Reply to "Untitled"

Here you can reply to the paste above