我有3张桌子
我已成功加入主题和用户以显示相关信息,但现在我正试图从posts
获取“post_content”但没有运气。
这是我的代码。
$sql = "SELECT users.user_id, users.username, users.profile, topics.topic_id,
topics.category, topics.sub_category, topics.topic_data,
topics.posted_by, topics.posted, topics.view, topics.reply, posts.post_content
FROM topics
LEFT JOIN users
ON topics.posted_by = users.user_id
WHERE topics.category = '" . mysql_real_escape_string($_GET['category']) . "'
AND topics.sub_category = '" . mysql_real_escape_string($_GET['sub_category']) . "'
OR topics.category = '" . mysql_real_escape_string($_GET['category']) . "'
OR topics.sub_category = '" . mysql_real_escape_string($_GET['sub_category']) . "' ORDER BY topics.posted DESC";
我已经查了公会以及如何参加JOINS,但却对这个公司感到难过。