I'm a newbie in PHP and MySQL and this is my first post in this forum.
I have two tables, one for users, the other for questions (it's kind of a trivia game). I don't want to display to the user the same question twice, so I store the "id" of already answered questions in a field of the user's record (as a string). Ie:
--> table "questions"
id | more_stuff
1 | blah, blah, blah
2 | blah, blah, blah
...
--> table "users"
nick | Already_answered_questions
John | ,4,17,548,72,36,41,9045,210,
...
So, I would like, if possible, create a sentence which would, in plain english:
SELECT * FROM questions WHOSE ("," + id + ",") is not in contents of (Already_answered_questions FROM users WHOSE nick = "John")
If such one-liner isn't possible, what do you think would be the fast way to do the task?
Actually, my only thoughts are retrieving all the questions' id, the field Already_answered_questions, and loop through. But I will have many users, many already-answered-questions and many questions to loop-thru, so this approach seems slow and very intensive.
Many thanks in advance for any comments!