Leosan Posted February 15, 2011 Share Posted February 15, 2011 I am writing a forum system, and I am working on the new posts portion. Everything is working fine but it lists multiple "duplicate" topic rows when a topic as 2 or more new posts. What I want to do is basically limit the sql to prevent a row being outputted if the field topic_id is duplicate. e.g I want to cut topic_id 3 topic_id 2 topic_id 2 topic_id 1 to topic_id 3 topic_id 2 topic_id 1 Quote Link to comment https://forums.phpfreaks.com/topic/227787-limit-results-by-field-php-mysql/ Share on other sites More sharing options...
eevan79 Posted February 15, 2011 Share Posted February 15, 2011 Have you tried GROUP BY topic_id http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html Quote Link to comment https://forums.phpfreaks.com/topic/227787-limit-results-by-field-php-mysql/#findComment-1174665 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.