I have two tables A and B. I need to pull data from them in a combined statement using GROUP_CONCAT. Currently, it does not work as I expected. So I separated the statement into two seperated simple statements to test.
This is how I did.
Tabel A
FIELD1 FIELD
1 A
2 B
3 C
Table B
FIELD1 FIELD2
1 1,2
2 1
3 2,3
I can read the Tabel B as follows
SELECT B.FIELD2 FROM B WHERE FIELD1=3
Output is
FIELD2
2,3
Now if I read Tabel A as follows
SELECT GROUP_CONCAT(A.FIELD2) FROM A WHERE FIELD1 IN (2,3)
I get
FIELD2
B,C
Now I want to get the same output with the following statement but it fails.
SELECT GROUP_CONCAT(A.FIELD2) FROM A WHERE FIELD1 IN (SELECT B.FIELD2 FROM B WHERE FIELD1=3)
Any help fixing the statement?