neo926 Posted March 12, 2006 Share Posted March 12, 2006 Okay, I don't know the proper way to query my db, and I'm not adept enough to find what I'm looking for in the MySQL Manual.So, I have a table that contains all my data for various sports columns that have been written. I have fields for author, sport, title, content, and date submitted.What I would like is to be able to query the db in a way so that it can recall the different sports that have been written about, but I don't want the same sport repeated. For example, let's say that there are currently 7 columns in the db, and if I were to recall the sports field on each column I would get the following list:footballbaseballfootballsoccerhockeyhockeybasketballI want to be able to query the db and have it give me the following list instead:footballbaseballsoccerhockeyThat way any duplicate entries aren't produced. Thanks in advance for any help. Quote Link to comment https://forums.phpfreaks.com/topic/4763-recalling-unique-field-entries-from-mysql/ Share on other sites More sharing options...
wickning1 Posted March 12, 2006 Share Posted March 12, 2006 Try using DISTINCT, e.g.[code]SELECT DISTINCT sport FROM articles[/code] Quote Link to comment https://forums.phpfreaks.com/topic/4763-recalling-unique-field-entries-from-mysql/#findComment-16743 Share on other sites More sharing options...
neo926 Posted March 12, 2006 Author Share Posted March 12, 2006 Great, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/4763-recalling-unique-field-entries-from-mysql/#findComment-16778 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.