Here is a MYSQL Question:
I have the below order table which has the orderid and within which you will have multiple categories of items
ORDER TABLE
| Orderid | Category |
|---|---|
| 1 | A |
| 1 | B |
| 1 | C |
| 1 | D |
| 2 | A |
| 2 | C |
| 2 | D |
Now, here we need to find out the frequency of the combination of categories ordered together. Combination of Category is the combination of two categories in a single order that the user purchased.
The output table should look like this:
| Category1 | Category2 | Count of Orders |
|---|---|---|
| A | B | 1 |
| A | C | 2 |
| A | D | 2 |
| B | C | 1 |
| B | D | 1 |
| C | D | 2 |
This table will give the final count of orders across every combination of categories present in order.
Question: Here i am not able to get all the combination of categories and then ties it up with count of order.Can you please help me here?