Re: Re: Re: Re: Untitled

From Ample Meerkat, 2 Months ago, written in Plain Text, viewed 109 times. This paste is a reply to Re: Re: Re: Untitled from Rude Cockroach - view diff
URL http://codebin.org/view/1569b399 Embed
Download Paste or View Raw
  1. SELECT i.billing_country AS country,
  2. COUNT(i.total) AS total_invoice,
  3. COUNT(DISTINCT c.customer_id) AS total_customer
  4. FROM invoice AS i
  5. LEFT OUTER JOIN client AS c ON c.customer_id = i.customer_id
  6. WHERE EXTRACT(YEAR FROM CAST(invoice_date AS timestamp)) IN
  7. (SELECT EXTRACT(YEAR FROM CAST(invoice_date AS timestamp))
  8. FROM invoice
  9. WHERE EXTRACT(MONTH FROM CAST(invoice_date AS timestamp)) IN (6,7,8)
  10. GROUP BY EXTRACT(YEAR FROM CAST(invoice_date AS timestamp))
  11. ORDER BY SUM(total) DESC
  12. LIMIT 1)
  13. GROUP BY i.billing_country
  14. ORDER BY total_invoice DESC, country;

Replies to Re: Re: Re: Re: Untitled rss

Title Name Language When
Re: Re: Re: Re: Re: Untitled Big Meerkat text 2 Months ago.

Reply to "Re: Re: Re: Re: Untitled"

Here you can reply to the paste above