我有两张桌子:
question
question_id | question
question_answer
answer_id | question_id | choice_id | user_id | explain
我想获取特定用户尚未回答的所有问题。
SELECT question, question_id as questionId
FROM question q
LEFT JOIN question_answer qa USING(question_id)
WHERE qa.user_id!=$userId
在这种情况下,我得到零行。我也试过
SELECT question, q.question_id as questionId
FROM question q
LEFT JOIN question_answer qa ON q.question_id=qa.question_id AND qa.user_id!=$userId
显然这会返回所有记录。我卡在这里如何进行此查询。