I have two tables: Table1 & Table2. Both the tables are given below:
here is table1
+----+----------+
| id | t1_title |
+----+----------+
| 1 | AAA |
+----+----------+
| 2 | BBB |
+----+----------+
| 3 | CCC |
+----+----------+
here is table2
+----+----------+--------+
| id | t2_title | t1_IDs |
+----+----------+--------+
| 1 | John | 1,3 |
+----+----------+--------+
| 2 | Sam | 2 |
+----+----------+--------+
| 3 | Monty | 1,2 |
+----+----------+--------+
| 4 | Rose | 2,3 |
+----+----------+--------+
Now I want to get the table1.title
(like AAA,BBB,CCC) based on the table2.t1_IDs
, something like this:
+----+----------+-----------+
| id | t2_title | t1_titles |
+----+----------+-----------+
| 1 | John | AAA,CCC |
+----+----------+-----------+
| 2 | Sam | BBB |
+----+----------+-----------+
| 3 | Monty | AAA,BBB |
+----+----------+-----------+
| 4 | Rose | BBB,CCC |
+----+----------+-----------+