I am trying to use the results of a subquery in an IN query to return some results from a table based on some ids in a second table. The structure of Table1 is not important, but Table2 stores information like this:
other_ID  | members
1         | .10.,.16.,.86.
2         | .32.,.34.
other_ID is stored as INT while members is stored as TEXT. I didn't create the table structure, but my understanding is that members is stored in that format since it gets tricky storing variable-length CSVs in columns in a database. Either way, I'm not able to change the table structure.
I have the following query:
SELECT * FROM Table1 WHERE
Table1.ID IN (REPLACE((SELECT members FROM Table2 WHERE other_ID = 2), ".", ""));
Try as I might, the query only ever returns values from the first value in the members column (i.e. 32). If I try the following query:
SELECT * FROM Table1 WHERE Table1.ID IN (32,34);
The results are returned successfully.
Any ideas as to what I'm doing wrong?


select replace(members,".","")SELECT members FROM Table2 WHERE other_ID = 2returns.32.,.34., which is not useable. Is that what you meant?