2013-08-20 22 views
0

我有一个旧的论坛。在这个论坛有很多双重主题(相同标题)。我发现这个选择所有的双主题标题:重复主题标题搜索从1海报

SELECT topic_title, topic_time, forum_id, topic_first_post_id, topic_first_poster_name, topic_id, topic_poster, COUNT(*) TotalCount 
FROM phpbb3_topics 
GROUP BY topic_title 
HAVING COUNT(*) >1 

现在我想从同一个人topic_poster

请你告诉我一个解决方案的所有双主题标题?请编辑我暴露出来的选择中,以示与同topic_poster ID所有双主题标题的方式(topic_poster是ID字段)

非常感谢您

+3

呃,GROUP BY人,TOPIC_TITLE ...? – Strawberry

回答

0

试试这个:

SELECT topic_poster_id, topic_title, topic_time, forum_id, topic_first_post_id, topic_first_poster_name, topic_id, topic_poster, COUNT(*) TotalCount 
FROM phpbb3_topics 
GROUP BY topic_poster_id, topic_title 
HAVING COUNT(*) >1 
0

你可以通过添加topic_poster到组:

SELECT topic_title, topic_time, forum_id, topic_first_post_id, topic_first_poster_name, topic_id, topic_poster, COUNT(*) TotalCount 
FROM phpbb3_topics 
GROUP BY topic_title, topic_poster 
HAVING COUNT(*) >1 
+0

是的,完成了!非常容易/多么可耻:)主题关闭!非常感谢 – labu77