Hi,
I have a master table like below:
Sales Type Table
=============
| Sales Type |
| Online |
| Store Purchase |
| Door Delivery |
And Child Table like below.
Purchase Table
============
| Purchase id | Purchase Type | Customer id |
| 1 | Online | 100 |
| 2 | Door Delivery | 101 |
| 3 | Door Delivery | 102 |
| 4 | Door Delivery | 103 |
| 5 | Online | 104 |
| 6 | Door Delivery | 105 |
| 7 | Door Delivery | 106 |
| 8 | Online | 107 |
| Purchase id | Purchase Type | Customer id |
| 1 | Online | 100 |
| 2 | Door Delivery | 101 |
| 3 | Door Delivery | 102 |
| 4 | Door Delivery | 103 |
| 5 | Online | 104 |
| 6 | Door Delivery | 105 |
| 7 | Door Delivery | 106 |
| 8 | Online | 107 |
I need output like below:
| Sales Type | No of Sales |
| Online | 3 |
| Store Purchase | 0 |
| Door Delivery | 5 |
Kindly help me on how to achieve it in SQL.
Thanks.