Hi!
Below code not working in MySql. Show errors.
SELECT t21.ID, STUFF((SELECT Concat(',' , t1.NAME)
FROM tmp_Person AS t1
INNER JOIN tmp_Products AS t2
ON Concat(',' , t2.PersonId ,',') LIKE Concat('%,' ,CONVERT(t1.id, CHAR(250)) ,',%')
WHERE t2.ID = t21.ID
FOR XML PATH, TYPE).value('.[1]','nvarchar(max)'), 1, 1,'') AS PersonId, t3.NAME
FROM tmp_Products AS t21 JOIN tmp_Fruits t3 ON t3.ID = t21.FruitsId
The resul I want now.
ID
|
PersonId
|
NAME
|
1
|
Rustam,Sindbod,Sadriddin
|
apple
|
2
|
Rustam,Muhammad
|
cherry
|
3
|
Muhammad
|
banana
|
I used this link: