I have these tables:
Foods
| food_id | title |
| 1 | soy milk |
| 2 | banana |
| 3 | apple |
Nutrients
| food_id | nutrient_id | amount |
| 1 | n1 | 0.05 |
| 1 | n2 | 2 |
| 1 | n3 | 34 |
...
I need this:
| food_id | title | n1 | n2 | n3 |
| 1 | soy milk | 0.05 | 2 | 34 |
| 2 | banana | | | |
| 3 | apple | | | |
Struct
would also work.
I know all the joins, but can't wrap my head around this... how do I put nutrient_id
into a column title or a Struct
key?