Given two tables, i want to match values at certain position of the string in table two so that i can see how many produce does one student have:
Table1:
items | ids |
---|---|
apple | 3 |
banana | 4 |
carrot | 1 |
tangerine | 5 |
grape | 2 |
melon | 6 |
apple II | 7 |
Table2:
Student | Items |
---|---|
Adam | ‘ 12 5’ |
Eva | ‘ 3 16 ‘ |
Expected result is to list number of items based on table2 and table1:
Column A | apple | banana | carrot | tangerine | grape | melon | apple II |
---|---|---|---|---|---|---|---|
Adam | 1 | 2 | 5 | ||||
Eva | 1 | 3 | 6 |
Currently i check produce one by one using substring but i want to procedurally list all the items (i only added 7 items to simplify the problem, real table has string which is thousands of characters long)