I can placed here demo table one is order table another is order_details table
- in order table
| id | order_total | status |
|---|---|---|
| 1 | 300 | Delivered |
| 2 | 500 | Delivered |
- and another table order_details
| id | order_id | product_id | product_price | quantity |
|---|---|---|---|---|
| 1 | 1 | 1 | 150 | 1 |
| 2 | 1 | 2 | 150 | 1 |
| 3 | 2 | 2 | 300 | 2 |
| 4 | 2 | 3 | 200 | 1 |
i want this type data
| sl | order_id | count_unique_product_id_row |
|---|---|---|
| 1 | 1 | 2 |
| 2 | 2 | 2 |
To resolve this issue do this code: