为什么 sm.status_id 和 sm.user_id 出现未知列错误?我通常不将JOIN
关键字用于表连接。
...
FROM questions q, connections sm
JOIN users u ON q.user_id = u.id
JOIN users lu ON q.last_user = lu.id
JOIN (SELECT q2.id FROM questions q2 WHERE q2.status_id = sm.status_id LIMIT 2) x ON x.id = q.id
WHERE sm.user_id = 38
GROUP BY th.id