Re: Re: Re: Re: Re: Untitled

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

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

Title Name Language When
Re: Re: Re: Re: Re: Re: Untitled Capacious Crow text 2 Months ago.

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

Here you can reply to the paste above