我有以下疑问。
SELECT p.author_name, p.author_id,
DISTINCT p.topic_id, t.title
FROM `ibf_posts` p, `ibf_topics` t
WHERE p.topic_id = t.tid
ORDER BY pid DESC
LIMIT 8"
当我运行它时,我得到以下MySQL错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT p.topic_id, t.title FROM `ibf_posts` p, `ibf_topics` t WHERE p' at line 1
如果我移除
DISTINCT
此方案来自Invision电源板帖子和主题表。我试图得到最近8个主题的标题,其中有最新的帖子。在最新的热门文章列表中,我不希望同一主题出现多次。我想要一个唯一的标题列表。
-pid控制
-作者姓名
-作者id
-主题id
表:ibf U主题
-每日三次
tid与主题id相同