Sales With Subtotals and Grand Total
Medium
Subtotals & Pivoting
Return sales per (region, product), a subtotal per region (product shown as 'ALL') and a grand total (region and product 'ALL'). Sort regions alphabetically with the grand total last, and within a region products alphabetically with the subtotal last.
Table schema
Sales(region VARCHAR(10), product VARCHAR(10), amount INT)Sample data
region | product | amount
North | Pen | 10
North | Pen | 20
North | Book | 30
South | Pen | 5
South | Book | 15
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.