It's hard to give a title to this question but much easier to understand by showing the structure of tables:
There are 2 tables below:
Table A:
| idA(int) | label(json) |
|---|---|
| 1001 | [1, 3] |
| 1002 | [3, 2] |
Table B:
| idB(int) | name(string) |
|---|---|
| 1 | apple |
| 2 | orange |
| 3 | strawberry |
| ... | ... |
Require outputs:
| idA | apple | orange | strawberry |
|---|---|---|---|
| 1001 | 1 | 0 | 1 |
| 1002 | 0 | 1 | 1 |
how to use mysql query to get this ?