Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Best Seller by Gross Sales

Return the seller with the highest gross sales (all rows, refunds included) and the total.

Table schema

Sellers(id INT PRIMARY KEY, name VARCHAR(10), joined DATE)
Sales(id INT PRIMARY KEY, seller_id INT, amount INT, refunded INT)

Sample data

Sellers
id | name | joined
1 | ShopA | 2025-01-01
2 | ShopB | 2025-06-01
3 | ShopC | 2026-02-01

Sales
id | seller_id | amount | refunded
1 | 1 | 100 | 0
2 | 1 | 200 | 1
3 | 2 | 150 | 0
4 | 2 | 50 | 0
5 | 2 | 70 | 1

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.