From Tiny Moth, 9 Months ago, written in Plain Text, viewed 91 times.
URL http://codebin.org/view/e70c6644 Embed
Download Paste or View Raw
  1. SELECT EXTRACT(YEAR FROM CAST(invoice_date AS date)),
  2.        MIN(total),
  3.        MAX(total),
  4.        SUM(total),
  5.        COUNT(total),
  6.        ROUND(SUM(total) / COUNT(DISTINCT(invoice_id))
  7. FROM invoice
  8. WHERE billing_country IN ('USA',
  9.                          'United Kingdom',
  10.                          'Germany')
  11. ORDER BY CAST(invoice_date AS date) DESC;

Reply to "Untitled"

Here you can reply to the paste above