Hello to Everyone.
I have two table, for example;
TABLE Name X
________________
| id | A |
|____|_________|
| 1 | 1,2,4,8 |
|____|_________|
This Query is working in another TABLE Y,
mysql_query(" Select * from Y where id IN(1,2,4,8) ")
But this in not working,
mysql_query(" Select * from Y where id IN(Select A from X where id=1) ")
What can I do?
Thank You.
A better table design would be:
Values in the table would be:
Your query could then be
mysql_query(" Select * from Y where id IN(Select id from X where someid=1").To answer your question — You appear to be querying from PHP or something similar. Using the table structure you have, you could retrieve the value from table X using
mysql_query("Select A from X where id=1")and store the results in a variable. You could then execute a second query,mysql_query(" Select * from Y where id IN(" + yourVar + ") ").