I have a table where we have partners and orders are set.
|partner_id|order_id|
| -------- | ------ |
|1 |5 |
|1 |6 |
|2 |7 |
|4 |8 |
|4 |9 |
|4 |10 |
Here we have a table where partner information is set. Here id is partner_id from previous table.
|id|email |
|--| ------------------ |
|1 |[email protected]|
|2 |[email protected]|
|4 |[email protected] |
My question is there a any possibility by joining these tables get something like:
|partner_id|email |sale_count|
| -------- | ------------------ | -------- |
|1 |[email protected]| 3 |
|4 |[email protected] | 3 |
Basically my goal is to match orders by partner email and extract one of the partners with the same emails id.
ORDERS-a table where we have partners and orders are set. PARTNER_INFORMATION -Here we have a table where partner information is set.