- SELECT billing_country AS country,
- COUNT(total) AS total_invoice,
- COUNT(DISTINCT customer_id) AS total_customer
- FROM invoice
- WHERE EXTRACT(YEAR FROM CAST(invoice_date AS timestamp)) IN
- (SELECT EXTRACT(YEAR FROM CAST(invoice_date AS timestamp))
- FROM invoice
- WHERE EXTRACT(MONTH FROM CAST(invoice_date AS timestamp)) IN (6,7,8)
- GROUP BY EXTRACT(YEAR FROM CAST(invoice_date AS timestamp))
- ORDER BY SUM(total) DESC
- LIMIT 1)
- GROUP BY country
- ORDER BY total_invoice DESC, country;
Re: Re: Re: Untitled
From Rude Cockroach, 2 Months ago, written in Plain Text, viewed 93 times.
This paste is a reply to Re: Re: Untitled from Melodic Marmoset
- view diff
URL http://codebin.org/view/748ac08f
Embed
Download Paste or View Raw
— Expand Paste to full width of browser