+ 1
Are these 2 queries the same? (SQL)
1: SELECT * FROM tasks WHERE user_id = (SELECT id FROM users WHERE session_id = ?); 2: SELECT * FROM tasks INNER JOIN users ON tasks.user_id = users.id WHERE users.session_id = ?;
2 Réponses
0
SoloProg are there any preferences? In speed or whatever?
0
from my experience, the preference would be the second query. it is easier to read and from what i remember joins are more efficient than sub queries.