We have a MySQL database that has two tables, Warehouse and Crate
Warehouse:
WarehouseID (primary key)
Location (varchar)
Crate:
CrateID (primary key)
Warehouse (foreign key to a Warehouse record)
Max_Capacity (int) (the amount of boxes that can be packed into a crate)
I would like to write a query that returns a sum of all the crates' max_capacity for each Warehouse. I'm having trouble with duplicate entries and inner joins, so what I'm hoping for is something like:
LOCATION: WAREHOUSE_ID: TOTAL_CAPACITY:
Shoreline 1 60
Bellevue 2 120
Ballard 3 200
Each warehouse might have 10 or so crates.