aebstract Posted February 22, 2010 Share Posted February 22, 2010 Here is my current query: mysql_query("SELECT * FROM news WHERE id = '1'") or DIE(mysql_error()); I'm trying to do this exact same thing, except that I have a column called topic_id and I want it to only return 1 result per unique topic_id. I'm trying to find a way to do it, if I find something before someone responds I'll update the post. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/192985-grabbing-based-on-unique-row-entry-for-specific-column/ Share on other sites More sharing options...
sader Posted February 22, 2010 Share Posted February 22, 2010 "SELECT * FROM news WHERE topic_id = '1' LIMIT 1" Quote Link to comment https://forums.phpfreaks.com/topic/192985-grabbing-based-on-unique-row-entry-for-specific-column/#findComment-1016335 Share on other sites More sharing options...
aebstract Posted February 22, 2010 Author Share Posted February 22, 2010 Ack, firstly I posted the wrong query. (sry) mysql_query(" SELECT * FROM posts JOIN forums ON ( forums.forum_id = posts.forum_id ) JOIN users ON ( users.user_id = posts.poster_id ) ORDER BY post_time DESC LIMIT 4 "); I'm not trying to grab just 1 row, I'm trying to grab 4 rows from the database, but they have to have a unique topic_id. Quote Link to comment https://forums.phpfreaks.com/topic/192985-grabbing-based-on-unique-row-entry-for-specific-column/#findComment-1016342 Share on other sites More sharing options...
aebstract Posted February 22, 2010 Author Share Posted February 22, 2010 no ideas? Quote Link to comment https://forums.phpfreaks.com/topic/192985-grabbing-based-on-unique-row-entry-for-specific-column/#findComment-1016397 Share on other sites More sharing options...
fenway Posted February 24, 2010 Share Posted February 24, 2010 I see no reference to "topic_id" anywhere. Quote Link to comment https://forums.phpfreaks.com/topic/192985-grabbing-based-on-unique-row-entry-for-specific-column/#findComment-1017481 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.