Question: Hello! I need some help with my MySQL query. I want to find a total shipment cost (sum of all shipments out) of $1156.97 from
Hello! I need some help with my MySQL query.
I want to find a total shipment cost (sum of all shipments out) of $1156.97 from an unknown location (Origin_Location_ID), up to date, from my database.
In other words: Which Origin_Location_ID in my database/table have sent out shipments with a total cost of $1156.97 (so it can be 1, or 20, or 1000 shipments that adds up to this specific sum)
I have following tables:
Shipments table that includes:
- Shipment_ID
- Origin_Location_ID
- Destination_Location_ID
- Shipment_Cost (Decimal) (In USD)
Locations :
- Location_ID (Integer) (Primary Key)
- Location_City
- Location_State
Im struggling finding how to write this. How do i get the MySQL to SUM up all the total costs for each location, and find the one who has a total cost of $1156.97 ?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
