【发布时间】:2014-11-03 00:01:31
【问题描述】:
正如标题所说,我正在尝试获得类似 facebook 的功能,但由于某些原因,当我将其应用于左连接查询时,我得到重复的“post_id”列,这是为什么? :/
我认为我已经解释得足够充分,我希望最新的帖子首先显示在底部(从底部到顶部,查看查询应该能更详细地解释我想要什么)
这是工作查询(没有左连接,但我需要左连接来加载每个帖子上的所有 cmets)
Working: (need the left join functions though)
$select_post_comments = $db->query("SELECT * FROM (
SELECT * FROM ".TABLE_PREFIX."groups_comments
WHERE post_id='$escape_post_id_row'
ORDER BY comment_id DESC LIMIT 7
) a ORDER BY comment_id");
获取重复的 post_id 错误:/
$select_post_comments = $db->query("SELECT * FROM (
SELECT * FROM spud_groups_posts
LEFT JOIN spud_groups_comments ON spud_groups_posts.post_id = spud_groups_comments.post_id
WHERE spud_groups_posts.post_id='$post_id_feed' ORDER BY comment_id DESC LIMIT 7
) a ORDER BY comment_id");
是什么导致我收到此错误,据我所知,我已经尝试了所有方法
谢谢!
【问题讨论】: