There is a data table similar to the following.
Table I.
ID1 Name KeyId
1 a1 2 | 22 | 3 | 5
2 a2 5 | 22 | 33 | 1
3 a3 8 | 10 | 2 | 1
4 a4 9 | 10 | 11 | 22
5 a5 2
Table II
ID2 text
1 123
2 456
3 789
4 1112
The KeyId stores the IDs of Table 2 separated by "|" characters. Assuming that Table 2 has ID2 = 2, select the record with KeyId 2 in Table 1.
Conversely, if there is no 2 in KeyId, write 2 in it and separate it with "|".