在开发过程中用了
SELECT q.*,r.uid FROM exam_question as q LEFT JOIN exam_record as r ON q.id = r.question_id WHERE r.uid is null and q.is_del = 0 and q.sid = 61 and r.uid not in(1,2,3)r
查后为空
需要加上or r.uid is null 并跳转先后位置:
SELECT q.*,r.uid FROM exam_question as q LEFT JOIN exam_record as r ON q.id = r.question_id WHERE r.uid not in(1,2,3) or r.uid is null and q.is_del = 0 and q.sid = 61
r.uid not in(1,2,3) or r.uid is null 必须放在where 最开始位置条件