'SQL Aggregation of primary keys
So I have two tables in my sample database:
Table #1:
PRODUCT_ID TYPE DATE CONSUMER_ID
where PRODUCT_ID is the primary key.
Table #2:
PRODUCT_ID ORDER_DATE SENT RETURNED
which contains possible duplicates of PRODUCT_ID
I want a query which returns :
CONSUMER_ID TOTAL_PRODUCTS TOTAL_SENT TOTAL_RETURNED
Since I am fairly new to SQL, I cannot seem to join the two tables to get the meaningful data so any insight on this will be highly appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
