I am facing one issue related to Mysql Query can anyone help me this.
Table 1
ID Column1
1 Hello
2 Hi
3 Bye
Table 2
ID Column1 Column2
1 XYZ 2,3,2 (These ids are from Table one)
Now I need to fetch table2 data with column2 actual values(ie. Hi,Bye,Hi).
Currently, the Query which I am using is
SELECT a.Column1, GROUP_CONCAT(b.Column2)
FROM Table1 a, Table2 b
WHERE FIND_IN_SET(b.id, (SELECT Column2 FROM Table1
WHERE id =1))and b.id=1;
I am getting the result from this query but the problem is with the FIND_IN_SET Clause. if the ids are duplicate then it is returning the only unique value.
Can anyone help me with this, how can I get the values as per the passed argument.
If I am passing (2,3,2) then the result should be (Hi,Bye,Hi).