diff --git a/dmezentsev/postgresql/homework/Views.sql b/dmezentsev/postgresql/homework/Views.sql index 8454a63..6dbcc00 100755 --- a/dmezentsev/postgresql/homework/Views.sql +++ b/dmezentsev/postgresql/homework/Views.sql @@ -16,6 +16,7 @@ SELECT p.category, FROM dmezentsev.products p JOIN dmezentsev.orders_items oi ON p.id = oi.product_id JOIN dmezentsev.orders o ON oi.order_id = o.id +GROUP BY p.category WHERE o.status = 'paid' ORDER BY total_revenue DESC