I am trying to get result from my categories table using the parent path i have created. When i launch the request WHERE IN with manual data it's working perfectly. When i am trying the same request dynamically with subquery, i got only one result instead of 4 expected. I do not understand why, can you help me ?
http://sqlfiddle.com/#!2/88b68/6
/*Working query*/
SELECT t.id_categorie FROM t
WHERE t.id_categorie IN (1396,1399,1403,1412)
/*Not working by subquery ??*/
SELECT cat.id_categorie FROM t as cat
WHERE
cat.id_categorie IN (SELECT REPLACE(t.path,'.',',') FROM t WHERE t.id_categorie = 1412)
Thanks by advance,
Regards,