could you please tell me which one of these two sentences is faster?
1st sentence:
SELECT DISTINCT(t1.user_id) FROM table_users as t1 WHERE t1.user_town IN (SELECT t2.town FROM table_towns as t2)
2nd sentence:
SELECT DISTINCT(t1.user_id) FROM table_users as t1
INNER JOIN (SELECT t2.town FROM table_towns as t2) as t3 ON t1.user_town = t3.town
The Selects I use are usually a bit more complex. And when possible I try to use IN (...) because I can pass a value or a table select.