计数2而不是1值

时间:2014-02-18 14:48:50

标签: mysql

我的问题是表的“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

0 个答案:

没有答案