I want to fetch first 10 question haven’t seen by a user.
In order to do that, I need to store questions that have seen by that user into a table, named user_questions
So, my query is now:
SELECT * from questions WHERE questions.id NOT IN (select question_id from user_questions where user_id=1) LIMIT 0, 10
From what I have learnt, this query should be slower compare to similar join query. How could I construct a join query that produced the same result?
The equivalent join query is:
One caution, though, the results will not be in random order. Typically with a
limitclause, you would also specify anorder by.