eevan79 Posted October 15, 2010 Share Posted October 15, 2010 I want to get latest posts from phpbb3 forum. Here is my code: $table_posts = "phpbb_posts"; $table_users = "phpbb_users"; $sql = "SELECT $table_posts.post_id, $table_posts.topic_id, $table_posts.forum_id, $table_posts.post_subject, $table_posts.poster_id, $table_posts.post_time, $table_users.user_id, $table_users.username FROM $table_posts LEFT JOIN $table_users ON $table_users.user_id=$table_posts.poster_id WHERE forum_id <> 3 AND forum_id <> 21 ORDER BY post_time DESC LIMIT 5"; And it's working fine. But I want to improve this code and dont get data from same topic_id . Thats mean if there is already post from topic_id 45, I dont want to get another post from same topic_id. How to get latest posts, but not from same topic_id? Quote Link to comment https://forums.phpfreaks.com/topic/215920-get-data-but-not-from-same-ids/ Share on other sites More sharing options...
eevan79 Posted October 15, 2010 Author Share Posted October 15, 2010 Simple solution: GROUP BY $table_posts.topic_id Quote Link to comment https://forums.phpfreaks.com/topic/215920-get-data-but-not-from-same-ids/#findComment-1122425 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.