Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Выгрузите уникальные названия городов, в которых стоимость заказов превышает среднее значение за 2009 год.
- SELECT billing_city
- FROM invoice
- WHERE total >
- (SELECT AVG(total)
- FROM invoice
- WHERE EXTRACT(YEAR FROM CAST(invoice_date AS DATE)) = 2009)
- GROUP BY billing_city;
Advertisement
Comments
-
- нужно было использовать оператор MAX:
- SELECT billing_city
- FROM invoice
- WHERE total >
- (SELECT MAX(total)
- FROM invoice
- WHERE EXTRACT(YEAR FROM CAST(invoice_date AS DATE)) = 2009)
- GROUP BY billing_city;
Add Comment
Please, Sign In to add comment
Advertisement