kyalee Posted March 28, 2009 Share Posted March 28, 2009 I have a table with two columns. One column, the category column, not that it's important, can have multiple entries that are the same. So, assuming that I have ten rows in the table, and the category column has two possible entries, "foo" and "bar", is there a way for me to run a query that will return "foo" and "bar" only once? In other words, is there a search that I can run that will return the two possible categories without giving me every instance where they occur? I hope I'm describing the problem right. I can try again if people don't understand what I'm asking. Thanks. ETA: Oh, nevermind, I found it. In case this ever comes up on someone's search, the answer is SELECT DISTINCT *column* FROM *table* Quote Link to comment https://forums.phpfreaks.com/topic/151557-returning-duplicate-fields-in-a-column-only-once/ Share on other sites More sharing options...
jackpf Posted March 28, 2009 Share Posted March 28, 2009 You can put all your results into an array and then run array_unique() on it. That's how I did my "who's online" for my IM. It had me puzzled for a while though... Quote Link to comment https://forums.phpfreaks.com/topic/151557-returning-duplicate-fields-in-a-column-only-once/#findComment-795998 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.