Forum Moderators: coopster
'SELECT * FROM `table1` WHERE `column1` = ANY (SELECT `column1` FROM `table2` WHERE `column2` = X)';
the subquery returns multiple rows, and column1 on both tables are integers. got any idea?
select * from table1 a, table2 b where a.column1 = b.column1 and b.column2 = X;
you may have to list the fields you want to select explicitly though. I am not convinced that will get you exactly what you want though.
You may just be better to do 2 queries
SELECT `column1` FROM `table2` WHERE `column2` = X
then put the returned values into an array and use
SELECT * FROM `table1` WHERE `column1` in ($myarray);
btw, if any one else has any means of tweaking this, pls let me know.