How to write query in MYSQL for this?
Let's say 10 different color balls are there and they should be present in all units of a large boxes. All Large boxes have same or different no of units. Here i want to know that which color balls are missing from which unit and to which Large box that unit belongs to.
For example- The all color balls are present in all unit of all large boxes except the red one is missing from Unit C of Large box 1. If I get to know those i can easily put those into required unit easily. These are the sample tables.
Table1
| Color | Box | Unit |
|---|---|---|
| Red | 1 | A |
| Red | 1 | B |
| Red | 1 | C |
| Red | 2 | A |
| Red | 2 | B |
| Red | 3 | A |
| Red | 3 | C |
| Yellow | 1 | A |
| Yellow | 1 | B |
| Yellow | 1 | C |
| Yellow | 2 | A |
| Yellow | 2 | B |
| Yellow | 2 | C |
| Yellow | 3 | A |
| Yellow | 3 | C |
| Green | 1 | A |
| Green | 3 | A |
| Green | 3 | C |
| Green | 1 | C |
table 2
| Box | Unit |
|---|---|
| 1 | A |
| 1 | B |
| 1 | C |
| 2 | A |
| 2 | B |
| 2 | C |
| 3 | A |
| 3 | C |
Hope I'm clear now.