Hi,
I have two tables as below.
TableA:
ID (Primary Key)
Location
Date
TableB:
ID (Primary Key)
Qty
What I am trying to do is to return a result set with the first column displaying all locations with a particular date value with the second column displaying the sum of all TableB's Qty values for that location and date.
Thus, for each line of the resultset, if there are 2 records in TableA for a particular location and date. I want to go to TableB and sum the Qty values for the corresponding IDs in that table.
Is it possible to do this using one SQL statement?
I have two tables as below.
TableA:
ID (Primary Key)
Location
Date
TableB:
ID (Primary Key)
Qty
What I am trying to do is to return a result set with the first column displaying all locations with a particular date value with the second column displaying the sum of all TableB's Qty values for that location and date.
Thus, for each line of the resultset, if there are 2 records in TableA for a particular location and date. I want to go to TableB and sum the Qty values for the corresponding IDs in that table.
Is it possible to do this using one SQL statement?