我的问题是表的“topic_content”列tb_topics只有1行主题但COUNT(tt.topic_content)显示2而不是1.此查询有什么问题。一切都是正确的而不是那个。
SELECT tc.cat_id, tc.cat_name, tc.cat_description, COUNT(tt.topic_content),
COUNT(tr.reply_topic), tt.topic_subject, tu.lname, tu.fname, tt.topic_date
FROM tb_category AS tc
INNER JOIN tb_replies as tr
INNER JOIN tb_topics as tt
INNER JOIN tbl_students as tu
WHERE tu.studentID = tr.reply_by
AND tt.topic_cat = tc.cat_id