MySQL - Select rows with id from another table
Posted: 05 Feb 2015, 07:30
I have the following Select in MySQL:
But the IDs (2, 5, 8, ...) must be from a Select from another table.
So, how can I select the rows from table_1 with the IDs from table_2?
Code: Select all
$sql = "SELECT * FROM table_1 WHERE rank = 2 AND id IN(2, 5, 8)";
So, how can I select the rows from table_1 with the IDs from table_2?