我对 MySQL 很陌生,我正在尝试从 3 个表中进行选择。我不确定执行此操作的最佳方法,因此我尝试了以下查询(它一直有效,直到我将第二个内部联接添加到“主题”表中):
SELECT 
    posts.id AS post_id, 
    topic_id,
    date, 
    text, 
    username AS user,
    users.id AS user_id,
    topics.title AS title
FROM 
    posts 
INNER JOIN 
    users 
ON
    posts.user_id = users.id
INNER JOIN
    topics
ON
    topics.id =:topic_id
WHERE 
    topic_id =:topic_id
ORDER BY
    date ASC
那么有没有更简单的方法可以从 3 个表中进行选择?还是我做的很好,我只是在某个地方出错了?提前致谢